powered by Jive Software

Doubt some timing issue in openfire

Openfire use Mina as its network engine.

In Mina, the IoHandler is not thread-safe.(refer: https://mina.apache.org/mina-project/faq.html#do-i-need-to-make-my-iohandler-thr ead-safe)

That means all StanzaHandler.process() are not thread-safe.

After reading openfire’s source code, I found some timing issue(maybe), for example:

In MUC,

(1) ClientA: send presence stanza to create a room.

(2) Server: receive this presence stanza and create a room.

(3) ClientA: send iq submit stanza.

(4) Server: receive this iq submit stanza. Unlock room, then reply iq submit result stanza to client.

(5) ClientA: receive this iq submit result stanza and know the room was created. Next thing is show room UI…

But Whether there is a case of such a situation:

At (4) : After Server “unlock the room” and before “reply iq submit result stanza” to ClientA, the ClientB join and send the presence stanza of it to existing

occupants(ClientA).

In this case, ClientA maybe: Receive ClientB’s presence stanza first and then receive iq submit result stanza.

But the expected workflow of ClientA is: Receive iq submit result first stanza(ensure the room has been created) and then receive ClientB’s presence stanza.

My Openfire version is 3.9.3

Note: The analysis above is only code review, not practical problem.