I'm getting a lot of duplicate messages in one-on-one chats on the Conversations client. I receive duplicate messages from remote senders, as well as carbon copies.
When this happens, I notice that in the admin console, more than one session exists for the resource.
I've found that the "usersSessions" cache in RoutingTableImpl, which maps bare JID to full JIDs, has a lot of duplicate full JID values for one entry. Additionally, there are full JIDs in the collection that relate to sessions that are already gone.
Simply preventing duplicate full JIDs does therefor not seem the correct solution (although it does help). Something appears to be preventing JIDs from getting removed from that cache.
I seem to reproduce creating stale content in the "usersSessions" cache by simply logging in and logging out again. I did this with the Inverse plugin on a local build, that's pretty recent.
I think the behavior was introduced by this change: https://github.com/igniterealtime/Openfire/commit/f1cdfefc471d1bacc07990e6f9161151b0b853da#diff-42211d9b12f65e2f7e539cc97c0308afL198
Here, the set of full jids got replaced by a list of full jids - allowing for duplicates.