Bug report: RoutingTableImpl.removeClientRoute called twice

Openfire version: 4.7.0

Users connected with WebSocket client.
If a user has multiple sessions and close a client then “Routing User Sessions” cache entry for the user is removed instead of removing the route from entry value!

Scenario:

  1. User A logged in with one client session:
    2846871@teles.de/c5-test-ancs-1

  2. User B logged in with two client session:
    3060222@teles.de/c5-test-ancs2-1-1
    3060222@teles.de/c5-test-ancs2-1-2

http://localhost:9090/SystemCacheDetails.jsp?cacheName=Routing+User+Sessions&searchKey=userB%domain%09

Cache value: [3060222@teles.de/c5-test-ancs2-1-1, 3060222@teles.de/c5-test-ancs2-1-2]

  1. Close userB@domain/session-B-2 client.

http://localhost:9090/SystemCacheDetails.jsp?cacheName=Routing+User+Sessions&searchKey=userB%domain%09

No entry found !!!

Cache value should be: [3060222@teles.de/c5-test-ancs2-1-1]

http://localhost:9090/SystemCacheDetails.jsp?cacheName=Routing+User+Sessions&searchKey=3060222%40teles.de%09

Server log:

# Websocket session 2 opened
2022-03-22 14:34:31,456 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Adding client route 3060222@teles.de/c5-test-ancs2-1-2
2022-03-22 14:34:31,457 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Adding client route ClientRoute{nodeID=061c753b-7052-4a17-bfa6-754f02d5f66a, available=true} to users cache under key 3060222@teles.de/c5-test-ancs2-1-2
...
# Websocket session 2 closed:
# Client route added again ???
2022-03-22 14:35:08,094 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Adding client route 3060222@teles.de/c5-test-ancs2-1-2
2022-03-22 14:35:08,095 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Adding client route ClientRoute{nodeID=061c753b-7052-4a17-bfa6-754f02d5f66a, available=false} to users cache under key 3060222@teles.de/c5-test-ancs2-1-2
# Remove client route, called at first time: OK
2022-03-22 14:35:08,114 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Removed users cache entry for 3060222@teles.de/c5-test-ancs2-1-2 / ClientRoute{nodeID=061c753b-7052-4a17-bfa6-754f02d5f66a, available=false}, changing entry count from 11 to 10
2022-03-22 14:35:08,116 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Removing client route 3060222@teles.de/c5-test-ancs2-1-2 from local routing table
# Remove client route, called second time ???? 
2022-03-22 14:35:08,124 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Removed users cache entry for 3060222@teles.de/c5-test-ancs2-1-2 / null, changing entry count from 10 to 10
2022-03-22 14:35:08,127 [Jetty-QTP-BOSH-7567] WARN org.jivesoftware.openfire.spi.RoutingTableImpl - Client route not found for route 3060222@teles.de, while user session still exists, Current content of users cache is {2480345@teles.de/c5-wc-ge2ivb=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}, 3060222@teles.de/c5-test-ancs2-1-1=ClientRoute{nodeID=061c753b-7052-4a17-bfa6-754f02d5f66a, available=true}, 1975940@teles.de/c5-j0m1y=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}, 1976008@teles.de/c5-gx6Z2=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}, 2846871@teles.de/c5-test-ancs-1=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}, 1975980@teles.de/c5-6Vfjs=ClientRoute{nodeID=061c753b-7052-4a17-bfa6-754f02d5f66a, available=true}, 909@teles.de/c5-xtooj=ClientRoute{nodeID=061c753b-7052-4a17-bfa6-754f02d5f66a, available=true}, 2851983@teles.de/c5-wc-anfnjc=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}, 2394314@teles.de/c5-WebCommunicator-xoh012=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}, 3084751@teles.de/c5-wc-sbp5fw=ClientRoute{nodeID=9b3e3214-3b69-4c4b-a80e-c1ccad271c22, available=true}}
2022-03-22 14:35:08,129 [Jetty-QTP-BOSH-7567] DEBUG org.jivesoftware.openfire.spi.RoutingTableImpl - Removing client route 3060222@teles.de/c5-test-ancs2-1-2 from local routing table

Thank you for reporting this. This sounds like a pretty serious bug. I have raised a new ticket for it: [OF-2423] - Ignite Realtime Jira

1 Like

This issue should be fixed in the upcoming Openfire 4.7.3 release.