Deadlock while getting Roster before it's initialized


If XMPPConnection#getRoster is invoked after a login and the roster isn't received yet, smack will get stuck on waiting for roster initialization without success (it times out). Because the RosterPacketListener which handles the initialization depends also on the waiting XMPPConnection#getRoster method.




Guenther Niess
February 11, 2010, 8:27 PM

Committed a patch to revision 11620.

Guenther Niess
February 11, 2010, 8:21 PM

In the XMPPConnection class is commented:

If this is the first time the user has asked for the roster after calling login, we want to wait for the server to send back the user's roster. This behavior shields API users from having to worry about the fact that roster operations are asynchronous, although they'll still have to listen for changes to the roster.
Note: because of this waiting logic, internal Smack code should be wary about calling the getRoster method, and may need to access the roster object directly.

but the RosterEntry#getGroups method which is called within the RosterPacketListener:

depends on the XMPPConnection#getRoster method.

Your pinned fields
Click on the next to a field label to start pinning.


Guenther Niess


Guenther Niess