magro / memcached-session-manager

A tomcat session manager that backups sessions in memcached and pulls them from there if asked for unknown sessions
Apache License 2.0
760 stars 346 forks source link

loadBackupSession hangs in non-sticky mode #404

Open RDiazR2 opened 5 years ago

RDiazR2 commented 5 years ago

Hello

We think we found several scenarios in which backup session can't be found and the node in which is expected to be stored is down and if those conditions are matched, loadBackupSession at MemcachedSessionService.java never finish:

while(result == null && (nextNodeId = _memcachedNodesManager.getNextAvailableNodeId(nextNodeId)) != null && !nextNodeId.equals(nodeId)) { final String newSessionId = getSessionIdFormat().createNewSessionId(requestedSessionId, nextNodeId); result = loadBackupSession(newSessionId, newNodeId); }

If we don't understand this code wrong. If the requested session is i.e: E7B85F58A0BB5C8FAAA9BB90317B0E3F-node1 and the node 1 is down, this loop never finish. Am I wrong?

We thing this can happen in several scenarios, but all of them have one thing in common: node encoded in JSESSIONID is down. In our example: node1.

The scenarios we think can generate an incorrect behavior because of the previous identified loop are:

The steps are the following:

If you need any clarification or information, please let me know.

We tested with:

Thanks a lot catalina_test1.zip