On 08/10/2020 10:04, Tim N wrote:
> Hi,
> 
> I'm in the early stages of analysing this problem:
> 
>    - Tomcat Embedded 9.0.37 with clustering enabled
>    - SpringBoot application, 2.1.16
>    - Login with no existing JSESSIONID fails
> 
> I can see the following code is executed twice within one request, the
> login attempt:
> 
> *~/.m2/repository/org/apache/tomcat/tomcat-catalina/9.0.37/tomcat-catalina-9.0.37-sources.jar!/org/apache/catalina/session/ManagerBase.java:677*
> 
>     public void add(Session session) {
>         sessions.put(session.getIdInternal(), session);
> 
> The first time it's executed, the session with the Spring context is added.
> The second time it's executed, a second session with the same ID, but
> without the Spring context, or any other session attribute I add for that
> matter, overwrites the existing session, and login fails. If I debug and
> prevent this by renaming the second session ID, login works because the
> original session is preserved.
> 
> The stack-trace for the first call is shown below:
> 
> add:678, ManagerBase (org.apache.catalina.session)
> setId:358, StandardSession (org.apache.catalina.session)
> setId:327, DeltaSession (org.apache.catalina.ha.session)
> setId:345, DeltaSession (org.apache.catalina.ha.session)
> createSession:719, ManagerBase (org.apache.catalina.session)
> createSession:422, DeltaManager (org.apache.catalina.ha.session)
> createSession:410, DeltaManager (org.apache.catalina.ha.session)
> doGetSession:3043, Request (org.apache.catalina.connector)
> getSession:2441, Request (org.apache.catalina.connector)

<snip/>

This is the app triggering the creation of the session.

> The stack-trace for the second call is shown below:
> 
> add:678, ManagerBase (org.apache.catalina.session)
> setId:358, StandardSession (org.apache.catalina.session)
> setId:327, DeltaSession (org.apache.catalina.ha.session)
> handleSESSION_CREATED:1322, DeltaManager (org.apache.catalina.ha.session)
> messageReceived:1192, DeltaManager (org.apache.catalina.ha.session)

<snip/>

This is the DeltaManager receiving notification that a new session has
been created.

> Any help would be appreciated. I can replicate this every time and spend
> some time investigating this.

The new session created message should be send to (and then processed
on) every node *except* the node on which the session was originally
created.

Can you show us how you configured this cluster please?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to