Openfire looses messages when multiple senders send messages to the same receiver that looses connection
when multiple senders send messages to the same receiver in parallel it can happen that Openfire losses messages and do not call backup deliverer when receiver looses connection in the meantime.
The problem is in org.jivesoftware.openfire.session.LocalClientSession.deliver(Packet). There it gets checked if the connection is closed. If this is the case then the packet is dropped silently. You can reproduce this with breakpoints. Example sequence to reproduce:
sender2 is in org.jivesoftware.openfire.session.LocalClientSession.deliver(Packet) before the if statement
sender1 thread is in org.jivesoftware.openfire.nio.NIOConnection.deliver(Packet)
sender1 thread catches IOException and closes connection
sender2 now evaluates if statement and silently drops packet
The expected behavior myself was that Openfire uses the offline cache strategy for this packet now.
I do not know the Openfire code in detail, but I think the org.jivesoftware.openfire.Connection.isClosed() check can be simply removed. org.jivesoftware.openfire.nio.NIOConnection.deliver(Packet) and org.jivesoftware.openfire.net.SocketConnection.deliver(Packet) do the check again anyway and pass the packet do backup delivery if connection is closed.
Thanks a lot