Unable to match user session in RoutingTable correctly


From master branch, (also affecting 4.7.0), IQBindHandler:handleIQ is mutating the username string before saving the mutated string key in the routing table session map in:

        String username = authToken.getUsername().toLowerCase();

In my use case, when a user loses connectivity temporarily and the stream resumption kicks in, the server returns what’s described in XEP-xxxx: Instant Stream Resumption correctly.
However upon closer inspection, the user session is present, but with a different key.

On a more technical level, RoutingTableImpl::getClientRoute incorrectly resolves null, as per the following method:

public ClientSession getClientRoute(JID jid) {
    // Check if this session is hosted by this cluster node
    ClientSession session = (ClientSession) localRoutingTable.getRoute(jid);
    if (session == null) {
        // The session is not in this JVM so assume remote
        RemoteSessionLocator locator = server.getRemoteSessionLocator();
        if (locator != null) {
            // Check if the session is hosted by other cluster node
            ClientRoute route = getClientRouteForLocalUser(jid);
            if (route != null) {
                session = locator.getClientSession(route.getNodeID().toByteArray(), jid);
    return session;

It would be appreciated if you could grant me access to create defects in Jira, if possible

We generally limit Jira access to keep the noise down there. Are you able to submit a github pull request with the suggested fix?


Awesome, you should also be able to create Jira issues now.