Delay in logout

Hi All,

We have built a IM client using Smack and run on Wildfire 2.4.0 server. When a user logs out from the client, we perform some custom database processes. It used to take small delay and logout the user from the server. This was the case when testing locally.

We have moved the Wildfire server to our main server. We are running client from remote machine. When the user logs out, it take 30-40 secs before he is logged out from the server.

Can someone tell me what could the delay be because of? Also does Smack send any message when user logs out?

Thanks

Mahaveer

What’'s going on at the packet level? Is it 30-40 secs before you get the closing stream answer? Also, how long is your custom database code taking now?

Regards,

Matt

The total process of server recieving closing message and the db interaction is 30-40 secs. DB interaction is not taking much time, db is on the same server.

Do the client send any message to the server about logged out, so that I can check my log file for that message?

Thanks

Mahaveer

It’‘s really hard for me to say what might be going on due to your customizations. Have you hooked up a debugger to trace what’'s going on? That might provide more clues…

Good luck!

-Matt

We have using Wildfire 2.4.4 and smack 2.0.0 as server and client respectively. I have added a plugin which implements

SessionEventListener, and on sessionDestroyed() I call some custom DB request. In the same class I print a log off

message.

When I run my client and server locally the client is logged off immediately and I see logged off message from the

plugin.

Now when I move this to the production server, it takes couple of minutes for the server to know when the client logged

off.

The questions are: Has anyone run into this issue? Is there a better method to trigger a logoff at the server?

This is code for logout plugin.

package org.jivesoftware.wildfire.plugin;

Imports …

public class LogoutPlugin implements Plugin {

private ClientIDSessionEventListener listener = new ClientIDSessionEventListener();

public void initializePlugin(PluginManager manager, File pluginDirectory) {

SessionEventDispatcher.addListener(listener);

}

public void destroyPlugin() {

SessionEventDispatcher.removeListener(listener);

}

private class ClientIDSessionEventListener implements SessionEventListener {

public void sessionCreated(Session session) {

}

public void sessionDestroyed(Session session) {

String username = JID.unescapeNode(session.getAddress().getNode().toLowerCase());

System.out.println("username on logout - " + username);

try {

Properties prop = new Properties();

prop.load(new FileInputStream("…/conf/jive.properties"));

String ipaddress = prop.getProperty(“ipaddress”);

// Do some custom db part

System.out.println(sername + " logoff");

}

catch (MalformedURLException e) {

System.out.println("MalformedURLException = " + e);

}

catch (Exception e) {

System.out.println("Exception = " + e);

}

}

public void anonymousSessionCreated(Session session) {

}

public void anonymousSessionDestroyed(Session session) {

}

}

}

Hi Mahaveer,

it’'s very hard to understand where the time is lost. Maybe you can change some lines of your code to log a timestamp and into the common log files:

//System.out.println(…);

Log.debug(…);

/code

If you are using your plugin as posted below, without the custom DB access - do you also get a timeout there?

How long takes this query if you execute it (without Wildfire) on your production database? If it takes long you may consider staring a new thread to do the logout activities.

LG

Thanks Matt and LG for your response. I have found my solution. I want not closing the connection at th client and it was taking long for the server to log off the user.

Thanks

Mahaveer