memcached-session-manager icon indicating copy to clipboard operation
memcached-session-manager copied to clipboard

Tomcat7 sharing is not successful.

Open koulq opened this issue 7 years ago • 4 comments

Hello, I am using tomcat7.0.81. After configuration, session sharing is not successful. Below are my configuration and jar packages.

qq 20180320195229 qq 20180320195350

The session stored in memcached is as follows. qq 20180320195617 The sessionId is always changing, and the background log shows no errors.

koulq avatar Mar 20 '18 11:03 koulq

Not all those jars should be in tomcat/lib, kryo related jars should be in WEB-INF/lib (which is automatically the case when you add the msm-kryo-serializer as maven dependency to your application) - for details see https://github.com/magro/memcached-session-manager/wiki/SetupAndConfiguration#add-memcached-session-manager-jars-to-tomcat and the following paragraph.

magro avatar Mar 20 '18 18:03 magro

But I can use Tomcat6.

koulq avatar Mar 21 '18 00:03 koulq

I have the same issue! The sessionId is always changing, and the tomcat log shows: Apr 22, 2019 6:29:36 PM de.javakaffee.web.msm.MemcachedSessionService changeSessionIdOnMemcachedFailover WARNING: Could not find session in local session map. java.lang.IllegalArgumentException: The given node id aa19-4f81-9668-dfadfa1bb08f is not part of this list [n1] at de.javakaffee.web.msm.NodeIdList.getNextNodeId(NodeIdList.java:60) at de.javakaffee.web.msm.MemcachedNodesManager.getNextAvailableNodeId(MemcachedNodesManager.java:359) at de.javakaffee.web.msm.MemcachedSessionService.loadBackupSession(MemcachedSessionService.java:885) at de.javakaffee.web.msm.MemcachedSessionService.changeSessionIdOnMemcachedFailover(MemcachedSessionService.java:861) at de.javakaffee.web.msm.RequestTrackingContextValve.changeRequestedSessionId(RequestTrackingContextValve.java:128) at de.javakaffee.web.msm.RequestTrackingContextValve.invoke(RequestTrackingContextValve.java:98) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:74

and nodeId="aa19-4f81-9668-dfadfa1bb08f", , I think maybe SessionIdFormat.extractMemcachedId() has some bugs?

final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId ); @CheckForNull public String extractMemcachedId( @Nonnull final String sessionId ) { final int idxDash = sessionId.indexOf( '-' ); if ( idxDash < 0 ) { return null; } final int idxDot = sessionId.indexOf( '.' ); if ( idxDot < 0 ) { return sessionId.substring( idxDash + 1 ); } else if ( idxDot < idxDash ) /* The dash was part of the jvmRoute */ { return null; } else { return sessionId.substring( idxDash + 1, idxDot ); } }

zhipingch avatar Apr 22 '19 13:04 zhipingch

Cloud you help me fix the bugs?

zhipingch avatar Apr 22 '19 13:04 zhipingch