Uploaded image for project: 'Openfire'
  1. Openfire
  2. OF-1596

Websocket sessions are not cleaned up properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Component/s: BOSH
    • Labels:
      None

      Description

      When a client that is connected via websockets gets a sudden disconnect (without sending proper stream close elements etc), then the session disappearance isn't handled properly.

      Notably, if the client was in a MUC room on the local server, it will remain in that room indefinitely.

      This problem might also affect clients that connect via BOSH / HTTP Binding (I did not test this) but does not affect clients connecting through sockets.

      The problem appears to involve this snippet in org.jivesoftware.openfire.SessionManager.ClientSessionListener#onConnectionClose:

                          
      if ((session.getPresence().isAvailable() || !session.wasAvailable()) &&
              routingTable.hasClientRoute(session.getAddress())) {
          // Send an unavailable presence to the user's subscribers
          // Note: This gives us a chance to send an unavailable presence to the
          // entities that the user sent directed presences
          Presence presence = new Presence();
          presence.setType(Presence.Type.unavailable);
          presence.setFrom(session.getAddress());
          router.route(presence);
      }

      The routingTable.hasClientRoute(session.getAddress()) statement unexpectedly evaluates to false for websocket connections (it's true for socket connections), which prevents a presence update for this session to be sent. As the MUC room was joined with a directed presence, it depends on this snippet to detect that the user left.

        Attachments

          Activity

            People

            Assignee:
            dwd Dave Cridland
            Reporter:
            guus Guus der Kinderen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: