NIOConnection Thread Deadlock when two clients in each others roster simultaneously disconnect


In testing the latest 3.10.0 Beta from the Github repository, a thread deadlock issue has been encountered.

The issue apparently occurs when two users, each with the other on their Roster, disconnect from the server at the same time.

Below is the relevant thread dump output for the deadlock situation:




A possible solution is to refactor the NIOConnection.close method, to invoke notifyCloseListeners() after the synchronized block. This is also how the method was arranged in Openfire versions at least as recent as 3.7.

Below is a refactored version of the method:




Tim Durden
January 7, 2016, 4:20 PM

Re-tested in Openfire 4.0.0 (nightly (5th Jan)) and could not replicate.

Note: Found jstack useful in assessing deadlock state:

Tom Evans
November 17, 2015, 6:19 PM

OK - that message indicates a "normal" error condition (dropped peer). Although benign, it should probably be a bit more helpful, and likely a debug message rather than an error. I will patch in the master branch for future release.

Daryl Herzmann
November 17, 2015, 5:13 PM

Tom, running 3.10 branch on Ignite and things seem to be OK. I do notice a fair number of these messages logged

At about a rate ~30 per hour.

Tom Evans
November 17, 2015, 12:00 AM

Submitted PR #374.

Tom Evans
November 13, 2015, 8:40 PM

Having another go at this one, based on this thread:



Tom Evans


Daryl Herzmann