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
758 stars 348 forks source link

The sessionId does not contain a nodeId so that the memcached node could not be identified #369

Closed twu027 closed 6 years ago

twu027 commented 7 years ago

Hi, @magro, please help if you can

I am trying to integrate the MSM into our application. I followed all the instructions and couldn't get it working. The logging are the following: 09-Nov-2017 13:19:36.488 INFO [localhost-startStop-1] de.javakaffee.web.msm.MemcachedSessionService.startInternal starts initialization... (configured nodes definition n1:10.92.132.33:8443,n2:10.92.132.34:8443, failover nodes n1) 09-Nov-2017 13:19:36.519 INFO [localhost-startStop-1] de.javakaffee.web.msm.RequestTrackingHostValve. *Setting ignorePattern to ..(ico|png|gif|jpg|css|js)$** 09-Nov-2017 13:19:36.535 INFO [localhost-startStop-1] de.javakaffee.web.msm.MemcachedSessionService.setLockingMode Setting lockingMode to null 09-Nov-2017 13:19:36.535 INFO [localhost-startStop-1] de.javakaffee.web.msm.MemcachedSessionService.createTranscoderFactory Creating transcoder factory de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory 09-Nov-2017 13:19:36.535 FINE [localhost-startStop-1] de.javakaffee.web.msm.MemcachedSessionService.loadTranscoderFactoryClass Loading transcoder factory class de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory using classloader WebappClassLoader context: collections delegate: false ----------> Parent Classloader: java.net.URLClassLoader@379f167a

09-Nov-2017 13:19:36.550 INFO [localhost-startStop-1] de.javakaffee.web.msm.serializer.kryo.KryoTranscoder. Starting with initialBufferSize 102400, maxBufferSize 2048000 and defaultSerializerFactory de.javakaffee.web.msm.serializer.kryo.DefaultFieldSerializerFactory 09-Nov-2017 13:19:36.566 INFO [localhost-startStop-1] de.javakaffee.web.msm.MemcachedSessionService.startInternal --------

09-Nov-2017 13:20:29.698 FINE [http-apr-8080-exec-10] de.javakaffee.web.msm.RequestTrackingHostValve.invoke >>>>>> Request starting: GET /collections/index.jsp (requestedSessionId null) ================== 09-Nov-2017 13:20:29.698 FINE [http-apr-8080-exec-10] de.javakaffee.web.msm.RequestTrackingHostValve.invoke <<<<<< Request finished: GET /collections/index.jsp ================== 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.RequestTrackingHostValve.invoke >>>>>> Request starting: GET /collections/ (requestedSessionId B9256587F5ACF853B041E9DD40F29638) ================== 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedNodesManager.canHitMemcached The sessionId does not contain a nodeId so that the memcached node could not be identified. 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedNodesManager.canHitMemcached The sessionId does not contain a nodeId so that the memcached node could not be identified. 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedNodesManager.canHitMemcached The sessionId does not contain a nodeId so that the memcached node could not be identified. 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedSessionService.createSession createSession invoked: null 09-Nov-2017 13:20:29.792 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.SessionIdFormat.createSessionId Creating new session id with orig id 'ping' and memcached id 'n2'. 09-Nov-2017 13:20:29.807 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.NodeAvailabilityCache.updateIsNodeAvailable CacheLoader returned node availability 'false' for node 'n2'. 09-Nov-2017 13:20:29.807 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.SessionIdFormat.createSessionId Creating new session id with orig id 'ping' and memcached id 'n1'. 09-Nov-2017 13:20:29.807 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.NodeAvailabilityCache.updateIsNodeAvailable CacheLoader returned node availability 'false' for node 'n1'. 09-Nov-2017 13:20:29.807 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.SessionIdFormat.createSessionId Creating new session id with orig id '56755F02FF8B90C061D5CD18F63CE029' and memcached id 'null'. 09-Nov-2017 13:20:29.807 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedSessionService.createSession Created new session with id 56755F02FF8B90C061D5CD18F63CE029 09-Nov-2017 13:20:30.792 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.BackupSessionService.backupSession Starting for session id 56755F02FF8B90C061D5CD18F63CE029 09-Nov-2017 13:20:30.792 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.BackupSessionService.backupSession Skipping backup for session id 56755F02FF8B90C061D5CD18F63CE029 as the session id is not usable for memcached. 09-Nov-2017 13:20:30.792 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.RequestTrackingHostValve.logDebugRequestSessionCookie Have request session cookie: domain=null, maxAge=-1, path=null, value=B9256587F5ACF853B041E9DD40F29638, version=0, secure=false 09-Nov-2017 13:20:30.792 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.RequestTrackingHostValve.logDebugResponseCookie Request finished, with Set-Cookie header: JSESSIONID=56755F02FF8B90C061D5CD18F63CE029; Path=/collections/; Secure; HttpOnly 09-Nov-2017 13:20:30.792 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.RequestTrackingHostValve.invoke <<<<<< Request finished: GET /collections/ ================== 09-Nov-2017 13:20:30.807 FINE [http-nio-8443-exec-8] de.javakaffee.web.msm.RequestTrackingHostValve.invoke >>>>>> Ignoring: GET /collections/js/global.js (requestedSessionId 56755F02FF8B90C061D5CD18F63CE029) ================== 09-Nov-2017 13:20:30.807 FINE [http-nio-8443-exec-8] de.javakaffee.web.msm.RequestTrackingHostValve.invoke <<<<<< Ignored: GET /collections/js/global.js ================== 09-Nov-2017 13:20:31.979 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.RequestTrackingHostValve.invoke >>>>>> Request starting: GET /collections/ViewLogin.do (requestedSessionId 56755F02FF8B90C061D5CD18F63CE029) ================== 09-Nov-2017 13:20:31.979 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.SessionIdFormat.createSessionId Creating new session id with orig id 'ping' and memcached id 'n2'. 09-Nov-2017 13:20:31.979 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.NodeAvailabilityCache.updateIsNodeAvailable CacheLoader returned node availability 'false' for node 'n2'. 09-Nov-2017 13:20:31.979 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.SessionIdFormat.createSessionId Creating new session id with orig id 'ping' and memcached id 'n1'. 09-Nov-2017 13:20:31.979 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.NodeAvailabilityCache.updateIsNodeAvailable CacheLoader returned node availability 'false' for node 'n1'. 09-Nov-2017 13:20:33.120 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.BackupSessionService.backupSession Starting for session id 56755F02FF8B90C061D5CD18F63CE029 09-Nov-2017 13:20:33.120 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.BackupSessionService.backupSession Skipping backup for session id 56755F02FF8B90C061D5CD18F63CE029 as the session id is not usable for memcached. 09-Nov-2017 13:20:33.120 FINE [http-nio-8443-exec-10] de.javakaffee.web.msm.RequestTrackingHostValve.logDebugRequestSessionCookie Have request session cookie: domain=null, maxAge=-1, path=null, value=56755F02FF8B90C061D5CD18F63CE029, version=0, secure=false

looks like it is unable to create a sessionid with -n1 or -n2 in it. Not sure why,

09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.RequestTrackingHostValve.invoke >>>>>> Request starting: GET /collections/ (requestedSessionId B9256587F5ACF853B041E9DD40F29638) ================== 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedNodesManager.canHitMemcached The sessionId does not contain a nodeId so that the memcached node could not be identified. 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedNodesManager.canHitMemcached The sessionId does not contain a nodeId so that the memcached node could not be identified. 09-Nov-2017 13:20:29.776 FINE [http-nio-8443-exec-2] de.javakaffee.web.msm.MemcachedNodesManager.canHitMemcached The sessionId does not contain a nodeId so that the memcached node could not be identified.

This is application is hosted by Tomcat 8 and sticky session behind the load balancer.

This is my context.xml for n1 node <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" memcachedNodes="n1:10.92.132.33:8443,n2:10.92.132.34:8443" failoverNodes="n1" sessionBackupAsync="false" requestUriIgnorePattern=".*.(ico|png|gif|jpg|css|js)$" transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" /> Context.xml for n2 node

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" memcachedNodes="n1:10.92.132.33:8443,n2:10.92.132.34:8443" sessionBackupAsync="false" failoverNodes="n2" requestUriIgnorePattern=".*.(ico|png|gif|jpg|css|js)$" transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" />

We have two servers hosting this application. So I made one of them n1 and another n2.

Could you please see any issues with my configuration?

Thanks Tony

twu027 commented 6 years ago

got the port wrong