Skip to content

Commit

Permalink
Revert "OF-2921: Prevent deadlock by not broadcasting synchronously"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guusdk committed Jan 22, 2025
1 parent dea629e commit c0c32ff
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ public synchronized void terminateDetached(LocalSession session) {
Presence presence = new Presence();
presence.setType(Presence.Type.unavailable);
presence.setFrom(session.getAddress());

// Broadcast asynchronously, to reduce the likelihood of the broadcast introducing a deadlock (OF-2921).
TaskEngine.getInstance().submit(() -> router.route(presence));
router.route(presence);
}

session.getStreamManager().onClose(router, serverAddress);
Expand Down Expand Up @@ -1362,9 +1360,7 @@ public void onConnectionClose(Object handback) {
Presence presence = new Presence();
presence.setType(Presence.Type.unavailable);
presence.setFrom(session.getAddress());

// Broadcast asynchronously, to reduce the likelihood of the broadcast introducing a deadlock (OF-2921).
TaskEngine.getInstance().submit(() -> router.route(presence));
router.route(presence);
}

session.getStreamManager().onClose(router, serverAddress);
Expand Down

0 comments on commit c0c32ff

Please sign in to comment.