Null pointer exception joining a room

Sorry for the late reply.

Please correct me if I am wrong:

  1. there are 3 nodes, node 1 is the senior member.
  2. on each node there is a client online (A node 1, B node 2, C node 3)
  3. node 1 is restarted
  4. node 2 becomes the senior member
  5. node 1 joins the cluster
  6. node 1 makes a SeniorMemberServicesRequest to node 2
  7. node 2 creates the response and gets the ServiceInfo for each service
  8. in the ServiceInfo constructor, all MUCRooms are fetched and a RoomInfo is created for each.
    In the RoomInfo constructor, an OccupantAddedEvent is created for each occupant.
  9. the NodeID of node 2 is taken before this fix.

=> for client C it is the wrong NodeID, because it should be the one of node 3.

  1. node 3 is stopped
  2. the leftCluster event in the MultiUserChatManager is called with the NodeID of node 3.
  3. all MUCRoles with the NodeID of node 3 are fetched from the MUCRoom and thus mucRoom.leaveRoom is called.

=> in our case this is none, because the RemoteMUCRole for client C of node 3 was provided with the NodeID of node 2. Therefore the role is not removed from the MUC.

=> if client C is now joined on node 1 in the MUC alreadyJoinedWithThisNick (approximately line: 619) is true and joinRole = occupantsByFullJID.get(user.getAddress()); (approximately line: 646) is null. Why this is null, I can’t tell “yet”. If the fix is applied, then the MUCRole is removed and the user can join without problems because alreadyJoinedWithThisNick returns false. But unfortunately, we found out yesterday that this error can still happen, it’s just apparently not as likely anymore.
In our case, each device has a unique resource (in the jid). If a new user logs in, they get a new resource. Each user can have multiple devices. Each user has a fixed nickname in the MUCs that is the same on all devices. I.e. it can happen that in the MUC a user is online several times with the same bare jid and the same nickname but different full jid. All devices automatically connect to the server in case of disconnections and automatically join the MUCs in which they have an affiliation>member.

Best Regards

chp