Project

General

Profile

Steram closed but user not marked offline and presence offline not generated

Nauman Bashir
Added over 4 years ago

Hi,

We've seen an issue with user going offline and server is not properly marking user offline, i.e. server somehow skips the step to update its online users info. And considers this user to be online. The presence offline packet is also not generated.

The issue occurs very rarely.

I am attaching log file where it can be seen the user has sent STREAM_CLOSED packet and server has acknowledged. After that server does not generate presence offline packet.


Replies (7)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

What version of the Tigase XMPP Server do you use? Unfortunately the log provided contains too little information to properly investigate the problem.

Added by Nauman Bashir over 4 years ago

We are using tigase-server-5.2.0-b3447.

The problem occurs when a user disconnects abruptly, without sending presence offline.

Server processes STREAM_CLOSED packet. But presence offline packet is not generated.

In case of an abrupt disconnection, does server generate presence offline packet ?

In log file (log_14_presence), stream disconnect packet is processed at line 3221.

Please let me know if any other information is required.

Thanks.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

I looked at the attached log file and there is something heavily messed up with your installation. Do you have any custom code by any chance? Looks like online users session data have wrong JIDs or the collections keeping online users data have messed up references. I have never seen anything like this. The log file does not make much sense, therefore, the server behavior might be unpredictable.

Added by Nauman Bashir over 4 years ago

We haven't modified any of the Tigase server code. We've added a few custom components and a couple of plugins. We've not made any changes to connection management code.

I also observed wrong JIDs assigned to connections ? What could cause that ?

We've a custom component for that keeps a list of online users. And a plugin that implements XMPPPresenceUpdateProcessorIfc. This plugin forwards presence packets to our component that updates users list. This component only keeps a list of JIDs. And doesn't do anything with connectionIds.

CORRECTION about server, we are using tigase-server-5.2.1-b3461.

Please let us know in which direction should we go for investigating this issue.

Thanks.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

Nauman Bashir wrote:

We haven't modified any of the Tigase server code. We've added a few custom components and a couple of plugins. We've not made any changes to connection management code.

Plugins can be responsible for such problems as they have access to users' session data.

I also observed wrong JIDs assigned to connections ? What could cause that ?

I have never seen such a problem before on any other installation. I cannot think of anything that may cause such a problem. Are you trying to authenticate more than one user over the same connection by any chance? Or maybe you authentication one JID and do resource bind for a different JID? Do you reuse connections for another user once one user has logged out?

These are just ideas which come to my mind. None of above should be possible as Tigase has lots of protections which should prevent this from happening. A proper investigation with full log analysis is necessary. I suggest you look at the log file and track both JIDs, when they logged in, what is session ID for both of them and when they messed up.

We've a custom component for that keeps a list of online users. And a plugin that implements XMPPPresenceUpdateProcessorIfc. This plugin forwards presence packets to our component that updates users list. This component only keeps a list of JIDs. And doesn't do anything with connectionIds.

Components (Assuming components in Tigase sense of API) cannot cause such a problem as they do not have access to SM data (assuming you use component API correctly). Plugins, however, in theory can cause such problems as they have access to user's data. However, again if API is used correctly a plugin has access to session of a single user during processing a packet.

Please let us know in which direction should we go for investigating this issue.

The only way I can see to track this down is to look in Tigase log files and track back a history of both JIDs. When they first connected, their initial connection ID, session ID and then look when they messed up.

Added by Nauman Bashir over 4 years ago

Hi Arthur, Thanks for looking into logs and giving suggestions.

I've analysed logs with incorrect connection JID and checked logs for all three users since their login. Their connectionIds do not get mixed up.

Apparently at some point in my code or server, a different from/to JID is assigned to the packet than the from/to attribute in the xml element.

How does packetFrom/packetTo JIDs in packet compare to from/to attributes in the packet.

Following are two consecutive log entries. In first entry there is a packet with packetFrom & pakcetTo set to null. In very next, SessionManager is looking for a connection based on a JID. Where was this JID stored? As getXMPPResourceConnection() only checks packetFrom & pakcetTo

13:42:35.405 [in_1-sess-man] SessionManager.processPacket() FINEST: Received packet: from=null, to=null, DATA=, SIZE=275, XMLNS=null, PRIORITY=PRESENCE, PERMISSION=NONE, TYPE=unavailable

13:42:35.405 [in_1-sess-man] SessionManager.getXMPPResourceConnection() FINEST: Searching for resource connection for: f335566d-8120-4e31-e040-0d0ade0e34e8@rxmpp.convo.com/res1

I got a little confused after seeing the code of getXMPPResourceConnection(packet p) in SessionManager. It is first checking packetFrom (JID)in the packet if not found, then it looks for packetTo (JID). Shouldn't it be just looking for toJID address to dispatch packet ?

Thanks.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

packetTo/From is for the Tigase internal addressing (like for communication between Tigase components), XML element (XMPP stanza) form/to is related to a standard XMPP communication - stanza sender and received JID. So they can be different.

However, there is something called a connectionID which always corresponds to a particular logged in user (JID). And what I saw in your log file is that at some point a connection ID was related to one JID and a few lines later to a different JID. This is something I do not understand and it looks there is something wrong.

    (1-7/7)