Deadlock while getting Roster before it's initialized

Description

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.

Environment

None

Activity

Show:

Guenther Niess February 11, 2010 at 8:27 PM

Committed a patch to revision 11620.

Guenther Niess February 11, 2010 at 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.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created February 11, 2010 at 8:14 PM
Updated October 28, 2020 at 1:28 PM
Resolved February 11, 2010 at 8:27 PM