Project

General

Profile

How to tell if IOService::forceStop() is closing a connection "normally"

Matthew M
Added almost 5 years ago

We are trying to debug our mobile client. As in XMPP spec, a "normal" disconnection from the client should be triggered by a "/stream:stream" sent from client to the server.

We would like to print a log in tigase server, such that

  1. client close the connection normally (it sends "/stream:stream" )

  2. server forces to close the connection (e.g, the TCP socket disconnected).

As the mobile client are facing bad network condition, as well as restrictions in the devices (memory, power), we would like to print such log from server end to help debug the mobile clients.

However, we found IOService::forceStop() is called for all kinds of disconnections. Is there any easy and reliable way to print such log in tigase, and recommendation would be great!


Replies (4)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 5 years ago

In class StreamManagementIOProcessor there is a method serviceStopped to which as a second argument is passed a flag streamClosed which has value true only if server received /stream:stream from client. But you should be careful about using this method and flag as this method maybe called multiple times for a single connection. Value of second argument passed to method serviceStopped for first call should determine if connection was closed or was lost.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

We would like to print a log in tigase server, such that

  1. client close the connection normally (it sends "/stream:stream" )

The /stream:stream data is kind of special so it is not normally printed out to a log file. However, when the server receives the stream close tag it prints a message like this to the log file:

 2013-09-26 09:25:39.105 [pool-15-thread-4]  ClientConnectionManager.xmppStreamClosed()  FINER: Stream closed: c2s@server/127.0.0.1_5222_127.0.0.1_47294

The Stream closed: text is the key here.

  1. server forces to close the connection (e.g, the TCP socket disconnected).

There is no specific place or message for it. This is because it usually happens when the server discovers the connection is either broken, or idle for too long or there is another connection replacing this one. Connection stopped: is the key message in the log file you should look for. But why it really happened, depends on the circumstances and other log entries around it are essential to understand the context.

As the mobile client are facing bad network condition, as well as restrictions in the devices (memory, power), we would like to print such log from server end to help debug the mobile clients.

We are well aware of all the problems. We have experience with deployment for all mobile devices only. Plus we have our own Android client - the open source software. Do you know of Tigase custom extensions designed specifically for mobile devices?

However, we found IOService::forceStop() is called for all kinds of disconnections. Is there any easy and reliable way to print such log in tigase, and recommendation would be great!

This is true. There is no easy way to tell why the disconnection happened. Only log analysis and all the events for the connection ID allow to find the right answer.

Added by Matthew M almost 5 years ago

Thanks for the reply! What are the Tigase custom extensions designed specifically for mobile devices? Would love to know!

    (1-4/4)