Skip to content

Commit c0c32ff

Browse files
committed
Revert "OF-2921: Prevent deadlock by not broadcasting synchronously"
This reverts commit b8b5713. Routing the unavailable presence that's sent out when a session closes cannot be made asynchronous. If the 'next step' is done prior to the routing of unavailable presence having completed, the session seems to be (partially) re-added. This causes an invalid state: the routing table no longer has the session, but caches such as the Routing Users Cache does. This incorrect behavior was introduced by a fix for OF-2921.
1 parent dea629e commit c0c32ff

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ public synchronized void terminateDetached(LocalSession session) {
291291
Presence presence = new Presence();
292292
presence.setType(Presence.Type.unavailable);
293293
presence.setFrom(session.getAddress());
294-
295-
// Broadcast asynchronously, to reduce the likelihood of the broadcast introducing a deadlock (OF-2921).
296-
TaskEngine.getInstance().submit(() -> router.route(presence));
294+
router.route(presence);
297295
}
298296

299297
session.getStreamManager().onClose(router, serverAddress);
@@ -1362,9 +1360,7 @@ public void onConnectionClose(Object handback) {
13621360
Presence presence = new Presence();
13631361
presence.setType(Presence.Type.unavailable);
13641362
presence.setFrom(session.getAddress());
1365-
1366-
// Broadcast asynchronously, to reduce the likelihood of the broadcast introducing a deadlock (OF-2921).
1367-
TaskEngine.getInstance().submit(() -> router.route(presence));
1363+
router.route(presence);
13681364
}
13691365

13701366
session.getStreamManager().onClose(router, serverAddress);

0 commit comments

Comments
 (0)