Project

General

Profile

About pseudo online

firstime firstime
Added almost 5 years ago

If client disconnect, then in SocketIO.java the read operation on socket will got -1 as following:

bytesRead = channel.read(tmp);

And, the channel will been closed as following:

        if (bytesRead == -1) {
            // we need to close channel but we should not throw exception as
            // in other way we will lose data from higher level internal buffers
            channel.close();
//          throw new EOFException("Channel has been closed.");
        }

The problem is here. the channel has been closed, but the XMPPResourceConnection, which has been saved in connectionsByFrom, has not been released. the connectionsByFrom is defined in SessionManager.java. And, when communicating with this client, other client will get pseudo XMPPResourceConnection and judge that the user is still online.

How to resolve this problem ? thanks.


Replies (4)

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

Which version of Tigase XMPP Server creates this situation when XMPPResourceConnection is not removed from connectionsByFrom in SessionManager?

Is StreamManagement enabled for this particular connection?

Added by firstime firstime almost 5 years ago

My version is 5.2.0. And i am sorry for that i don't know how to work about StreamManagementIOProcessor.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

Do you have any server logs in debug mode showing that the XMPPResourceConnection is not removed?

Added by firstime firstime almost 5 years ago

Sure, When othe client send message to the disconnected client, the XMPPResourceConnection will be checked firstly in SessionManagerClustered::processPacket() as following:

            XMPPResourceConnection conn = getXMPPResourceConnection(packet);

            if (log.isLoggable(Level.FINEST)) {
                log.log(Level.FINEST, "Ressource connection found: {0}", conn);
            }

Because the clien has disconnected, the value of conn should be null. But, the log shows that it is not null.

    (1-4/4)