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.
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:
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 theRosterPacketListener
which handles the initialization depends also on the waitingXMPPConnection#getRoster
method.