MSM use ServletRequest non-sticky sessioin error??

825 views
Skip to first unread message

gordanyang

unread,
May 8, 2012, 11:53:15 AM5/8/12
to memcached-session-manager
my msm config as follow:

<Manager
className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:10.2.121.30:11211"
sticky="false"
sessionBackupAsync="false"
lockingMode="none"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"

transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
/>

and my web.xml add the LoginFilter
if LoginFilter doFilter method add follow statment the browse
sessionid will changed.
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse, FilterChain filterChain) throws IOException,
ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse)
servletResponse;

HttpSession session = request.getSession(false);//the statement will
occur the browse sessionId changed.

}

Martin Grotzke

unread,
May 8, 2012, 12:09:54 PM5/8/12
to memcached-se...@googlegroups.com

I have to make too many assumptions about the other parts of your code and the steps you're performing. Please post a complete example with a detailed step by step guide that allows me to reproduce this.

Cheers,
Martin

gordanyang

unread,
May 9, 2012, 8:18:28 AM5/9/12
to memcached-se...@googlegroups.com
Hi,
The file system of attachment(for test) like this:
WebRoot
    images/***
    WEB-INF/****
    Workbench/index.jsp
    login.jsp
loginfilter config /workbench/*


And login.jsp type username as admin,password as admin.

1.login success will save session "_session_key" as true.

2.loginfilter get session "_session_key" if session is null will redirect to login.jsp

3.in this samples , MSM can't save session "_session_key" ,filter can't get the session "_session_key".

4.in login.jsp the session id is 

5.after login ,in workbench/index.jsp the session id is 

Extremely Weird,the session id has been changed.

I'm wonder why?

The version of tomcat is 6.0,and jdk 1.6.

Cheers,
AuYuengYueng

在 2012年5月8日星期二UTC+8下午11时53分15秒,gordanyang写道:
Test.rar

gordanyang

unread,
May 9, 2012, 9:50:57 AM5/9/12
to memcached-se...@googlegroups.com
the msm log like this:(sessionId is changed)

详细: <<<<<< Request finished: /test/Test ==================
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionTrackerValve invoke
详细: >>>>>> Request starting: /test/workbench/index.jsp ==================
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
详细: Loading session from memcached: 8B8C1D3201F3BF2F402888A02565C129-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
详细: Found session with id 8B8C1D3201F3BF2F402888A02565C129-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionService backupSession
详细: Starting for session id 8B8C1D3201F3BF2F402888A02565C129-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionTask call
详细: Starting for session id 8B8C1D3201F3BF2F402888A02565C129-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionTask call
详细: Finished for session id 8B8C1D3201F3BF2F402888A02565C129-n1, returning status SKIPPED
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.LockingStrategy onAfterBackupSession
详细: Stored session validity info for session 8B8C1D3201F3BF2F402888A02565C129-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
详细: Have request session cookie: domain=null, maxAge=-1, path=null, value=8B8C1D3201F3BF2F402888A02565C129-n1, version=0, secure=false, httpOnly=false
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionTrackerValve invoke
详细: <<<<<< Request finished: /test/workbench/index.jsp ==================
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.LockingStrategy pingSession
详细: Got ping result false
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.MemcachedSessionService createSession
详细: createSession invoked: null
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionIdFormat createSessionId
详细: Creating new session id with orig id '509AEA523B5FDCC032B5C061E982CC47' and memcached id 'n1'.
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.MemcachedSessionService createSession
详细: Created new session with id 509AEA523B5FDCC032B5C061E982CC47-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionTrackerValve invoke
详细: >>>>>> Request starting: /test/login.jsp ==================
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionService backupSession
详细: Starting for session id 509AEA523B5FDCC032B5C061E982CC47-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionTask call
详细: Starting for session id 509AEA523B5FDCC032B5C061E982CC47-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionTask doBackupSession
详细: Trying to store session in memcached: 509AEA523B5FDCC032B5C061E982CC47-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.BackupSessionTask call
详细: Finished for session id 509AEA523B5FDCC032B5C061E982CC47-n1, returning status SUCCESS
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.LockingStrategy onAfterBackupSession
详细: Stored session validity info for session 509AEA523B5FDCC032B5C061E982CC47-n1
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
详细: Have request session cookie: domain=null, maxAge=-1, path=null, value=509AEA523B5FDCC032B5C061E982CC47-n1, version=0, secure=false, httpOnly=false
五月 09, 2012 9:48:32 下午 de.javakaffee.web.msm.SessionTrackerValve invoke
详细: <<<<<< Request finished: /test/login.jsp ==================

Martin Grotzke

unread,
May 9, 2012, 6:16:00 PM5/9/12
to memcached-se...@googlegroups.com
Hi,

the issue was caused by the js-file (matched by
requestUriIgnorePattern): for this one a new session was created and the
cookie sent to the browser. The next request started with the new cookie
- thus loosing the authentication.

There seems to be an issue with non-sticky sessions and ignored
resources that cause a session lookup.

In the new version I'm currently working on this should be fixed. I had
a quick check and to me it seemed to be fine.

Can you test with the attached jars? (should work with the
msm-kryo-serializer in version 1.5.1)

An alternative solution would be to remove the .js from
requestUriIgnorePattern btw.

Cheers,
Martin
> <http://10.2.121.30:11211>"
> sticky="false"
> sessionBackupAsync="false"
> lockingMode="none"
> requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
>
> transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
>
> />
>
> and my web.xml add the LoginFilter
> if LoginFilter doFilter method add follow statment the browse
> sessionid will changed.
> public void doFilter(ServletRequest servletRequest, ServletResponse
> servletResponse, FilterChain filterChain) throws IOException,
> ServletException {
> HttpServletRequest request = (HttpServletRequest)
> servletRequest;
> HttpServletResponse response = (HttpServletResponse)
> servletResponse;
>
> HttpSession session =
> request.getSession(false);//the statement will
> occur the browse sessionId changed.
>
> }
>

--
Brakhane, Grotzke und Langbehn Informatiker und Physiker PartG
Breitenfelder Str. 13c, 20251 Hamburg
Amtsgericht Hamburg, PR 795
memcached-session-manager-1.6.2-SNAPSHOT.jar
memcached-session-manager-tc6-1.6.2-SNAPSHOT.jar
signature.asc

gordanyang

unread,
May 10, 2012, 8:30:56 AM5/10/12
to memcached-se...@googlegroups.com
thanks martin!

   i try to use the memcached-session-manager-1.6.2-SNAPSHOT.jar  ,It works very well。
   also i test msn with nginx+tomcat.msm config with non-sticky session.and if nginx configure is no ip_hash ,the sessionid also had been changed.
   i will try to test again.
   thanks martin !!


 

在 2012年5月8日星期二UTC+8下午11时53分15秒,gordanyang写道:
在 2012年5月8日星期二UTC+8下午11时53分15秒,gordanyang写道:

gordanyang

unread,
May 11, 2012, 4:33:27 AM5/11/12
to memcached-se...@googlegroups.com
Hi martin.
     
     The test app (Test.rar) ,I deploy to Tomcat7.0.27  in linux(jdk 64bit).and also deploy to Tomcat7.0.27 in windows (jdk 32bit).

there was extremely Weird. The test app in TC7(in windows)  work well.otherwise the test app in TC7(in linux) doesn't work(the sessionid also has been changed.)

The TC configure is(remove requestUriIgnorePattern) :
 <Context docBase="/java/Tomcat1/webapps/Test" path="/Test" reloadable="true" >                   
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
                        memcachedNodes="n1:10.2.121.30:11211,n2:10.2.121.31:11211"
sticky="false" 
    sessionBackupAsync="false"
    lockingMode="none"
    transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
        />
        </Context> 

gordanyang

unread,
May 11, 2012, 4:39:26 AM5/11/12
to memcached-se...@googlegroups.com

May 11, 2012 4:37:32 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n2'.
May 11, 2012 4:37:32 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n2'.
May 11, 2012 4:37:32 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: >>>>>> Request starting: /Test/login.jsp ==================
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n2'.
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n2'.
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Loading session from memcached: BC0D56B3E809B8169032D0836080081E-n2.e
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Found session with id BC0D56B3E809B8169032D0836080081E-n2.e
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Starting for session id BC0D56B3E809B8169032D0836080081E-n2.e
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Session attributes were not accessed since last backup/check, therefore we can skip this
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.LockingStrategy onAfterBackupSession
FINE: Stored session validity info for session BC0D56B3E809B8169032D0836080081E-n2.e
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
FINE: Have request session cookie: domain=null, maxAge=-1, path=null, value=BC0D56B3E809B8169032D0836080081E-n2.e, version=0, secure=false, httpOnly=false
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.LockingStrategy pingSession
FINE: Got ping result false
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: <<<<<< Request finished: /Test/login.jsp ==================
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask call
FINE: Storing backup in secondary memcached for non-sticky session BC0D56B3E809B8169032D0836080081E-n2.e
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n1'.
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n1'.
May 11, 2012 4:37:33 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask pingSessionBackup
FINE: Got backup ping result false
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n2'.
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n2'.
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: >>>>>> Request starting: /Test/images/JniDecrypt.js ==================
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.MemcachedSessionService backupSession
FINE: No session found in session map for 1BB8306B82E8219511A611438FE4D1F9-n2.e
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.LockingStrategy onBackupWithoutLoadedSession
FINE: Stored session validity info for session 1BB8306B82E8219511A611438FE4D1F9-n2.e
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.LockingStrategy pingSession
FINE: Got ping result false
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
FINE: Have request session cookie: domain=null, maxAge=-1, path=null, value=1BB8306B82E8219511A611438FE4D1F9-n2.e, version=0, secure=false, httpOnly=false
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n1'.
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: <<<<<< Request finished: /Test/images/JniDecrypt.js ==================
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n1'.
May 11, 2012 4:37:35 PM de.javakaffee.web.msm.LockingStrategy$OnBackupWithoutLoadedSessionTask pingSessionBackup
FINE: Got backup ping result false
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n1'.
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n1'.
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: >>>>>> Request starting: /Test/workbench/index.jsp ==================
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Loading session from memcached: CC3090C4A966A0CC555A2ED2F64BD711-n1.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Found session with id CC3090C4A966A0CC555A2ED2F64BD711-n1.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Starting for session id CC3090C4A966A0CC555A2ED2F64BD711-n1.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.BackupSessionTask call
FINE: Starting for session id CC3090C4A966A0CC555A2ED2F64BD711-n1.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.BackupSessionTask call
FINE: Finished for session id CC3090C4A966A0CC555A2ED2F64BD711-n1.e, returning status SKIPPED
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy onAfterBackupSession
FINE: Stored session validity info for session CC3090C4A966A0CC555A2ED2F64BD711-n1.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
FINE: Have request session cookie: domain=null, maxAge=-1, path=null, value=CC3090C4A966A0CC555A2ED2F64BD711-n1.e, version=0, secure=false, httpOnly=false
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy pingSession
FINE: Got ping result false
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: <<<<<< Request finished: /Test/workbench/index.jsp ==================
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask call
FINE: Storing backup in secondary memcached for non-sticky session CC3090C4A966A0CC555A2ED2F64BD711-n1.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n2'.
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n2'.
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask pingSessionBackup
FINE: Got backup ping result false
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: >>>>>> Request starting: /Test/login.jsp ==================
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Loading session from memcached: D305433002E31F10DB5653511F17B986-n2.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Found session with id D305433002E31F10DB5653511F17B986-n2.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Starting for session id D305433002E31F10DB5653511F17B986-n2.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Session attributes were not accessed since last backup/check, therefore we can skip this
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy onAfterBackupSession
FINE: Stored session validity info for session D305433002E31F10DB5653511F17B986-n2.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
FINE: Have request session cookie: domain=null, maxAge=-1, path=null, value=D305433002E31F10DB5653511F17B986-n2.e, version=0, secure=false, httpOnly=false
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy pingSession
FINE: Got ping result false
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: <<<<<< Request finished: /Test/login.jsp ==================
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask call
FINE: Storing backup in secondary memcached for non-sticky session D305433002E31F10DB5653511F17B986-n2.e
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n1'.
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n1'.
May 11, 2012 4:37:36 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask pingSessionBackup
FINE: Got backup ping result false
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n1'.
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n1'.
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: >>>>>> Request starting: /Test/login.jsp ==================
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Loading session from memcached: 83C79AFC7CBEABC6818DD371B2963BB9-n1.e
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
FINE: Found session with id 83C79AFC7CBEABC6818DD371B2963BB9-n1.e
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Starting for session id 83C79AFC7CBEABC6818DD371B2963BB9-n1.e
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.BackupSessionService backupSession
FINE: Session attributes were not accessed since last backup/check, therefore we can skip this
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.LockingStrategy onAfterBackupSession
FINE: Stored session validity info for session 83C79AFC7CBEABC6818DD371B2963BB9-n1.e
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.SessionTrackerValveTC7 logDebugRequestSessionCookie
FINE: Have request session cookie: domain=null, maxAge=-1, path=null, value=83C79AFC7CBEABC6818DD371B2963BB9-n1.e, version=0, secure=false, httpOnly=false
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.LockingStrategy pingSession
FINE: Got ping result false
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.SessionTrackerValve invoke
FINE: <<<<<< Request finished: /Test/login.jsp ==================
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask call
FINE: Storing backup in secondary memcached for non-sticky session 83C79AFC7CBEABC6818DD371B2963BB9-n1.e
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.SessionIdFormat createSessionId
FINE: Creating new session id with orig id 'ping' and memcached id 'n2'.
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.NodeAvailabilityCache updateIsNodeAvailable
FINE: CacheLoader returned node availability 'true' for node 'n2'.
May 11, 2012 4:37:37 PM de.javakaffee.web.msm.LockingStrategy$OnAfterBackupSessionTask pingSessionBackup
FINE: Got backup ping result false


在 2012年5月11日星期五UTC+8下午4时33分27秒,gordanyang写道:

Martin Grotzke

unread,
May 11, 2012, 6:54:45 AM5/11/12
to memcached-se...@googlegroups.com

What's the content of tomcat/lib folder? It seems there's still an old version of msm running.

Cheers,
Martin

gordanyang

unread,
May 12, 2012, 2:39:53 AM5/12/12
to memcached-se...@googlegroups.com
 Hi martin.

The tomcat/lib (in linux)  and  in windows is same.(I copy the tomcat folder (windows) to linux )
and the msm jar is 1.6.1 spmemcached is 2.7.8.

my test structure like this:

In linux environment the session seems that the session can't be shared(also like the sessionid is changed.).
I visit the http://10.2.121.30:8080/Test/login.jsp and login success.and the sessionid is correct.
and then i visit the http://10.2.121.31:8080/Test/workbench/index.jsp.It redirect to login.jsp.

It seems that the session can't ben shared in two different tomcat.

Is the Linux Tomcat's bug?(in windows the tomcat runs very well)




在 2012年5月11日星期五UTC+8下午6时54分45秒,Martin Grotzke写道:

在 2012年5月11日星期五UTC+8下午6时54分45秒,Martin Grotzke写道:

Martin Grotzke

unread,
May 12, 2012, 5:55:50 PM5/12/12
to memcached-se...@googlegroups.com
On 05/12/2012 08:39 AM, gordanyang wrote:
> Hi martin.
>
> The tomcat/lib (in linux) and in windows is same.(I copy the tomcat
> folder (windows) to linux )
> and the msm jar is 1.6.1 spmemcached is 2.7.8.
You need msm 1.6.2-SNAPSHOT. Now that you've switched to tomcat7 I
attach you the tc7 specific 1.6.2-SNAPSHOT jar.

Cheers,
Martin
memcached-session-manager-tc7-1.6.2-SNAPSHOT.jar
signature.asc

gordanyang

unread,
May 14, 2012, 8:24:32 AM5/14/12
to memcached-se...@googlegroups.com
Hi martin.
     
   I try to use memcached-session-manager-tc7-1.6.2-SNAPSHOT.jar in Tomcat2.0.27 .there was an error as fllow:
  (in webapps/lib.  I used msm-kryo-serializer-1.5.1.jar)

INFO: Registering reference, isContainerSessionLookup(): false
java.lang.RuntimeException: foo
        at de.javakaffee.web.msm.MemcachedSessionService.findSession(MemcachedSessionService.java:618)
        at de.javakaffee.web.msm.MemcachedBackupSessionManager.findSession(MemcachedBackupSessionManager.java:196)
        at org.apache.catalina.connector.Request.doGetSession(Request.java:2850)
        at org.apache.catalina.connector.Request.getSession(Request.java:2307)
        at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
        at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910)
        at com.gf.gfclient.filter.LoginFilter.doFilter(LoginFilter.java:83)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
        at de.javakaffee.web.msm.SessionTrackerValve2.invoke(SessionTrackerValve2.java:107)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:149)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)


在 2012年5月13日星期日UTC+8上午5时55分50秒,Martin Grotzke写道:

Martin Grotzke

unread,
May 14, 2012, 9:12:28 AM5/14/12
to memcached-se...@googlegroups.com
Ups, I forgot to remove this debug output ;-) See the updated/fixed jar
attached.

@Thomas, you should also replace the jar if you're using it.

Cheers,
Martin
memcached-session-manager-1.6.2-SNAPSHOT.jar
signature.asc

gordanyang

unread,
May 14, 2012, 10:21:58 AM5/14/12
to memcached-se...@googlegroups.com
Thanks Martin!

I try to use the new memcached-session-manager-1.6.2-SNAPSHOT.jar.but the log output like as follow,I'm wonder why?(Is sessionId changed?)

May 14, 2012 10:16:49 PM de.javakaffee.web.msm.LockingStrategy pingSession
WARNING: The session 1A360BE3C1F829FB0321D29FFFF27C3B-n1.e should be touched in memcached, but it seemed to be not existing anymore. Will store in memcached again.
May 14, 2012 10:16:49 PM de.javakaffee.web.msm.LockingStrategy onAfterLoadFromMemcached
WARNING: No validity info available for session 1A360BE3C1F829FB0321D29FFFF27C3B-n1.e
May 14, 2012 10:16:49 PM de.javakaffee.web.msm.LockingStrategy onBackupWithoutLoadedSession
WARNING: Found no validity info for session id 1A360BE3C1F829FB0321D29FFFF27C3B-n1.e
May 14, 2012 10:16:50 PM de.javakaffee.web.msm.LockingStrategy pingSession
WARNING: The session A6EB04D4C72AD45A091BFD3E54E3EF0D-n1.e should be touched in memcached, but it seemed to be not existing anymore. Will store in memcached again.
May 14, 2012 10:16:50 PM de.javakaffee.web.msm.LockingStrategy onBackupWithoutLoadedSession
WARNING: Found no validity info for session id A6EB04D4C72AD45A091BFD3E54E3EF0D-n1.e



在 2012年5月14日星期一UTC+8下午9时12分28秒,Martin Grotzke写道:

gordanyang

unread,
May 14, 2012, 10:37:18 AM5/14/12
to memcached-se...@googlegroups.com

Thanks Martin!

I try to use the new memcached-session-manager-1.6.2-SNAPSHOT.jar.but the log output like as follow,I'm wonder why?(Is sessionId changed?)

May 14, 2012 10:16:49 PM de.javakaffee.web.msm.LockingStrategy pingSession
WARNING: The session 1A360BE3C1F829FB0321D29FFFF27C3B-n1.e should be touched in memcached, but it seemed to be not existing anymore. Will store in memcached again.
May 14, 2012 10:16:49 PM de.javakaffee.web.msm.LockingStrategy onAfterLoadFromMemcached
WARNING: No validity info available for session 1A360BE3C1F829FB0321D29FFFF27C3B-n1.e
May 14, 2012 10:16:49 PM de.javakaffee.web.msm.LockingStrategy onBackupWithoutLoadedSession
WARNING: Found no validity info for session id 1A360BE3C1F829FB0321D29FFFF27C3B-n1.e
May 14, 2012 10:16:50 PM de.javakaffee.web.msm.LockingStrategy pingSession
WARNING: The session A6EB04D4C72AD45A091BFD3E54E3EF0D-n1.e should be touched in memcached, but it seemed to be not existing anymore. Will store in memcached again.
May 14, 2012 10:16:50 PM de.javakaffee.web.msm.LockingStrategy onBackupWithoutLoadedSession
WARNING: Found no validity info for session id A6EB04D4C72AD45A091BFD3E54E3EF0D-n1.e

WARNING: Could not load session with id 587AF63B57A0374C35BB05E85FE1B51C-n1.e from memcached.
java.lang.RuntimeException: The loaded object for sessionId 587AF63B57A0374C35BB05E85FE1B51C-n1.e is not of required type byte[], but java.lang.Integer
at de.javakaffee.web.msm.MemcachedSessionService.loadFromMemcached(MemcachedSessionService.java:1083)
at de.javakaffee.web.msm.MemcachedSessionService.findSession(MemcachedSessionService.java:600)
at de.javakaffee.web.msm.MemcachedBackupSessionManager.findSession(MemcachedBackupSessionManager.java:196)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2850)
at org.apache.catalina.connector.Request.getSession(Request.java:2307)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910)
at com.gf.gfclient.filter.LoginFilter.doFilter(LoginFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at de.javakaffee.web.msm.SessionTrackerValve2.invoke(SessionTrackerValve2.java:107)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:149)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1770)

Martin Grotzke

unread,
May 14, 2012, 10:43:10 AM5/14/12
to memcached-se...@googlegroups.com
On 05/14/2012 04:21 PM, gordanyang wrote:
> Thanks Martin!
>
> I try to use the new memcached-session-manager-1.6.2-SNAPSHOT.jar.but
> the log output like as follow,I'm wonder why?(Is sessionId changed?)
Please always provide enough information to help debugging. This inludes
steps to take to reproduce the issue, tomcat + msm versions,
configuration snippets (I don't want to look for the latest
configuration s.o. posted here, also it might no longer be valid) and
relevant log output. This includes log output that shows context of an
issue, not just the log message itself.

Cheers,
Martin
signature.asc

Martin Grotzke

unread,
May 14, 2012, 10:46:44 AM5/14/12
to memcached-se...@googlegroups.com
Hey, that's not nice. I don't want to get several pieces of information
that I have to put together by asking questions, looking up previous
emails etc. Please take you enough time to provide appropriate bug
reports / support requests!

Cheers,
Martin
signature.asc

gordanyang

unread,
May 16, 2012, 7:35:26 AM5/16/12
to memcached-se...@googlegroups.com
Hi Martin:

           My test environment is 4 Tomcat,1 Nginx ,and 2 Memcached,as follow:

1、Tomcat 10.2.121.30: 8080   Memcached: 10.2.121.30:11211 
2、Tomcat 10.2.121.30: 8081
3、Tomcat 10.2.121.31: 8080   Memcached: 10.2.121.31:11211
4、Tomcat 10.2.121.31: 8081 
5、nginx 10.2.121.241:80

the nginx configure like as :
upstream  backend  
{       server 10.2.121.31:8080 weight=1;
server 10.2.121.31:8081 weight=1;
server 10.2.121.30:8080 weight=1;
server 10.2.121.30:8081 weight=1;
}  
the msm configure like as :
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
                        memcachedNodes="n1:10.2.121.30:11211,n2:10.2.121.31:11211"
                        sticky="false"
    sessionBackupAsync="false"
    lockingMode="none"
sessionBackupTimeout="100"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
                />

step 1:

the single tomcat which i visit direct url (http://10.2.121.30(31):8080 )they runs correct.
when I visit by nginx loadbalance the sessionId always change(when i login success,It redirect to login.jsp)

step 2:
and then i change nginx configure (add ip_hash balance):
the nginx configure like as :
upstream  backend  
{       server 10.2.121.31:8080 weight=1;
server 10.2.121.31:8081 weight=1;
server 10.2.121.30:8080 weight=1;
server 10.2.121.30:8081 weight=1;
                ip_hash;

}  
then i visit http://10.2.121.241 is correct.

step 3:
the nginx configure like as :
upstream  backend  
{     
server 10.2.121.30:8080 weight=1;
server 10.2.121.30:8081 weight=1;
              

}  
then i visit http://10.2.121.241 is correct.

i really want to know why msm can be used in nginx load balance the tomcat's ip address as the same.
why msm can't be use in nginx load balance the tomcat's ip address as different.



gordanyang

unread,
May 21, 2012, 8:57:27 AM5/21/12
to memcached-se...@googlegroups.com
Hi Martin:

The attachment  file catalina.rar is the tomcat's catalina.out.
catalina.out-10.2.121.229 and catalina.out-10.2.121.31 the MSM non-sticky session runs very well.
catalina.out--10.2.121.161 and catalina.out--10.2.121.31(1) the MSM  non-sticky session has some problems.
(i only changed then 10.2.121.229 to 10.2.121.161)my msm lib is :
memcached-session-manager-1.6.2-SNAPSHOT.jar
memcached-session-manager-tc7-1.6.2-SNAPSHOT.jar
webapps lib is:
msm-kryo-serializer-1.5.1.jar
msm configure is :
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
                        memcachedNodes="n2:10.2.121.31:11211,n3:10.2.121.229:11211"
                        sticky="false"
    sessionBackupAsync="true"
    lockingMode="none"
    transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
                />


Can you help me to find out where my configure is wrong?


catalina.rar

Martin Grotzke

unread,
May 22, 2012, 7:48:49 AM5/22/12
to memcached-se...@googlegroups.com
Hi,

it seems that you have configured a jvmRoute in the tomcat server.xml,
as there are sessionIds like
EA8B61EB5225D85ED47D9D8D151AA8B7-n2.e
in one tomcat and
DF3F971BBB13F7DB9E9CC4F13171F689-n3.i
in the other tomcat.

With non-sticky session you must not use a jvmRoute in tomcat.

Cheers,
Martin
signature.asc

gordanyang

unread,
May 22, 2012, 11:51:31 PM5/22/12
to memcached-se...@googlegroups.com
Hi Martin:
       Thank you for quick replay my question.
I remove the jvmRoute in tomcat server.xml and  test again. and then there also has a problem,(seems sessioinid changed)
the attachment file catalina.rar is the tomcat's catalina.out.
I had try lots of times to test this issue. Can you help me to solve my issue. thanks again!! 




在 2012年5月21日星期一UTC+8下午8时57分27秒,gordanyang写道:
catalina.rar

Martin Grotzke

unread,
May 23, 2012, 3:56:49 AM5/23/12
to memcached-se...@googlegroups.com
Hi,

it's hard to correlate different requests, as the servers seem to have
set a different time (tomcat1 starts at May 23, 2012 11:39:20 AM while
tomcat2 starts at May 23, 2012 7:26:36 PM).

Please make sure that both have set the same time so that it's possible
to see the request sequence in the different log files.

Cheers,
Martin


On 05/23/2012 05:51 AM, gordanyang wrote:
> Hi Martin:
> Thank you for quick replay my question.
> I remove the jvmRoute in tomcat server.xml and test again. and then
> there also has a problem,(seems sessioinid changed)
> the attachment file catalina.rar is the tomcat's catalina.out.
> I had try lots of times to test this issue. Can you help me to solve my
> issue. thanks again!!
>
>
>
>
> 在 2012年5月21日星期一UTC+8下午8时57分27秒,gordanyang写道:
>
> Hi Martin:
>
> The attachment file catalina.rar is the tomcat's catalina.out.
> catalina.out-10.2.121.229 and catalina.out-10.2.121.31 the MSM
> non-sticky session runs very well.
> catalina.out--10.2.121.161 and catalina.out--10.2.121.31(1) the
> MSM non-sticky session has some problems.
> (i only changed then 10.2.121.229 to 10.2.121.161)my msm lib is :
> memcached-session-manager-1.6.2-SNAPSHOT.jar
> memcached-session-manager-tc7-1.6.2-SNAPSHOT.jar
> webapps lib is:
> msm-kryo-serializer-1.5.1.jar
> msm configure is :
> <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
> memcachedNodes="n2:10.2.121.31:11211
> <http://10.2.121.31:11211>,n3:10.2.121.229:11211
> <http://10.2.121.229:11211>"
> sticky="false"
> sessionBackupAsync="true"
> lockingMode="none"
>
> transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
> />
>
>
> Can you help me to find out where my configure is wrong?
>
>

signature.asc

gordanyang

unread,
May 24, 2012, 9:28:02 AM5/24/12
to memcached-se...@googlegroups.com
Hi Martin:

   It's great!!.
  
   I set the same time.and the MSM and tomcat run very well.

   thank you  very much !!!

   so  great!!! cool.



在 2012年5月23日星期三UTC+8下午3时56分49秒,Martin Grotzke写道:

Martin Grotzke

unread,
May 24, 2012, 10:05:49 AM5/24/12
to memcached-se...@googlegroups.com
Ok, it makes sense that this causes issues :-)

Cheers,
Martin
--
inoio gmbh
Breitenfelder Str. 13c, 20251 Hamburg
Amtsgericht Hamburg, HRB 123031
Geschäftsführer: Dennis Brakhane, Martin Grotzke, Ole Langbehn

signature.asc
Reply all
Reply to author
Forward
0 new messages