Rest API and Multi-node Hazelcast cluster - room occupants kicked out unexpectedly

Hello, I’m using Openfire 4.2.3 with REST API plugin 1.3.9 and two nodes hazelcast cluster (plugin 2.4.2).
I found unexpected behavior of PUT /plugins/restapi/v1/chatrooms/{roomName} API. When I send the HTTP request, one cluster node that received the HTTP request has room occuoants without change but the other node has no occupants unexpectedly.
The reproduction procedure is as follows

  1. Start two Openfire nodes with REST API plugin
  2. Connect to Openfire with XMPP client (I uses Spark)
    You can see room occupants with Openfire admin console
  3. Send HTTP request to GET http://{HOST}:9090/plugins/restapi/v1/chatrooms/{roomName}
  4. Send HTTP request to PUT http://{HOST}:9090/plugins/restapi/v1/chatrooms/{roomName} with using the response of 3. as body
    One cluster node that received the HTTP request has room occuoants without change but the other node has no occupants unexpectedly

And I found that CacheFactory.doClusterTask(new RoomAvailableEvent((LocalMUCRoom) room)) (MUCRoomController.java#L295) causes the unexpected behavior. But I still do not know how to fix it.

openfire-restAPI-plugin/MUCRoomController.java at master · igniterealtime/openfire-restAPI-plugin · GitHub

PUT http://{HOST}:9090/plugins/restapi/v1/chatrooms/{roomName} request sample:
http://{HOST}:9090/plugins/restapi/v1/chatrooms/test01

{
    "roomName": "test01",
    "naturalName": "test01",
    "description": "test01",
    "subject": "",
    "creationDate": 1557363318534,
    "modificationDate": 1557363318550,
    "maxUsers": 0,
    "persistent": true,
    "publicRoom": true,
    "registrationEnabled": false,
    "canAnyoneDiscoverJID": false,
    "canOccupantsChangeSubject": false,
    "canOccupantsInvite": false,
    "canChangeNickname": false,
    "logEnabled": false,
    "loginRestrictedToNickname": false,
    "membersOnly": false,
    "moderated": false,
    "broadcastPresenceRoles": [
        "moderator",
        "participant",
        "visitor"
    ],
    "owners": [
        "admin@example.com"
    ],
    "admins": [],
    "members": [],
    "outcasts": [],
    "ownerGroups": [],
    "adminGroups": [],
    "memberGroups": [],
    "outcastGroups": []
}

please any help

I found out a solution.
PR: https://github.com/igniterealtime/openfire-restAPI-plugin/pull/27

1 Like