Project

General

Profile

Bosh issue: message could only be send one way

Matthew M
Added about 5 years ago

I have a strange problem with BOSH connection. When a bosh user is connected and sending message to others, sometime, this user entered a strange state: it can send message to others, but can NOT receive any message from others.

After spending sometime tracing into the code, we found something interesting. Sometime, there is a valid BoshIOService for a Bosh user, so the message from this user is received by Tigase and forwarded to the buddy. But the "XMPP Session" does not exists any more. Then the rely from the buddy can never be forwarded to this bosh user any more.

To verify our thoughts, we change the code a bit just to facilitate the log, and we found there is a few logs in the system, not many though.

Do you have any idea about this?

   public synchronized void processSocketPacket(Packet packet, BoshIOService service,
    Queue<Packet> out_results) {

        // we add some debugging code here
        SessionManager sessMan = (SessionManager) XMPPServer.getComponent("sess-man");
        XMPPSession xsession = sessMan.getSessionsByNodeId().get(this.userJid.getBareJID());
        if (xsession.getResourceConnection(this.userJid) ==null) 
              System.out.println("Found a bosh connection that has no XMPP session, this user will never receive any packets?");

       //original code ....
        ....
    }

By the way, while trying to understand the code to see if we have done something wrong on our side, we get a bit lost between the relationship of a few classes, such as "BoshSession", "BoshIOService", "XMPPSession" and "XMPPResourceConnection". What's the connection between BoshSession to XMPPSession, or is BoshSession related to XMPPResourceConnection?


Replies (2)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 5 years ago

Your findings are very interesting. I think we have fixed similar problem like this a while ago but I am not sure whether this was exactly the same issue. What Tigase server version do you use? If you use the most recent Tigase version please submit a bug report .

  1. BoshSession - this is an object maintained by BoshConnectionManager with metadata related to user Bosh session. It directly corresponds to the XMPPResourceConnection - object maintained by SessionManager component, there is a single BoshSession for each user's resource connected to the system.

  2. BoshIOService - this is an object maintained by BoshConnectionManager and it keeps a physical TCP/IP connection between a Bosh client and the BoshConnectionManager. There may be multiple such objects for each BoshSession, they are closed and opened during a Bosh session.

  3. XMPPSession - this is an object maintained by SessionManager and it contains metadata for a single user logged into the system. There maybe multiple user's connections (resources - BoshSession, XMPPResourceConnection) but there is only one XMPPSession.

  4. XMPPResourceConnection - is an object maintained by SessionManager and it contains metadata about a single user's connection - resource it usually corresponds to an object in connection manager (BoshSession in BoshConnectionManager, XMPPIOService in ClientConnectionManager, etc....)

Added by Matthew M about 5 years ago

Thanks for the explanation! The bug is filed at https://projects.tigase.org/issues/1695

    (1-2/2)