You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gustavo Almeida <gu...@gmail.com> on 2021/06/20 02:54:32 UTC

Where does Tomcat 9 (apt managed / standard config) store sessions in Ubuntu 18?

-Ubuntu 18.04.5
-Tomcat/9.0.16 (Ubuntu)
-JVM 11.0.11+9

"Configuration Reference - The Manager Component" says:
"A Manager element MAY be nested inside a Context component. If it is not
included, a default Manager configuration will be created automatically"

My Context has no nested Manager element.

So, guessing I'm using by default the Standard Manager Implementation,
where does it store active sessions, if it does at all?

With this setup, the locations of interest that I found until now are:
/var/lib/tomcat9
/etc/tomcat9
usr/share/tomcat9
var/log/tomcat9
/etc/default/tomcat9

Re: Where does Tomcat 9 (apt managed / standard config) store sessions in Ubuntu 18?

Posted by Carsten Klein <c....@datagis.com>.
Gustavo,

On 20.06.21 04:54, Gustavo Almeida wrote:
> "Configuration Reference - The Manager Component" says:
> "A Manager element MAY be nested inside a Context component. If it is not
> included, a default Manager configuration will be created automatically"
>
> My Context has no nested Manager element.
>
> So, guessing I'm using by default the Standard Manager Implementation,
> where does it store active sessions, if it does at all?

Olaf is right. StandardManager keeps active sessions in Memory. However, 
when its _Persistence Across Restarts_ features comes into play 
(https://tomcat.apache.org/tomcat-10.0-doc/config/manager.html#Persistence_Across_Restarts), 
it persists active sessions to disk in order to preserve these across a 
restart of either the context or the whole server.

Configuration option 'pathname' specifies, where on disk sessions are 
persisted. StandardManager serializes all sessions into a single file 
specified by 'pathname'. This defaulted to "SESSIONS.ser" and was a file 
path relative to the context's TEMP directory. However, on 2020-02-18 
that was changed to null, effectively disabling the Session Persistence 
Feature by default due to possible performance issues with a large 
number of sessions.

If you want it back, you could set 'pathname' to an absolute path of 
your choice. However, on Ubuntu, Tomcat runs in a sandbox and by default 
only has write access to a defined list of directories (see file 
tomcat9.service) as well as to /tmp and /cache.

Option 'pathname' can also take a path relative to the context's work 
directory, which is in /var/lib/tomcat9/work (a symlink to 
/var/cache/tomcat9/). There, under Catalina/<hostname, typically 
localhost> is a directory named after the context. That is the context's 
working directory. This is where "SESSIONS.ser" used to be.





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


Re: Where does Tomcat 9 (apt managed / standard config) store sessions in Ubuntu 18?

Posted by Olaf Kock <to...@olafkock.de>.
On 20.06.21 04:54, Gustavo Almeida wrote:
> "Configuration Reference - The Manager Component" says:
> "A Manager element MAY be nested inside a Context component. If it is not
> included, a default Manager configuration will be created automatically"
>
> My Context has no nested Manager element.
>
> So, guessing I'm using by default the Standard Manager Implementation,
> where does it store active sessions, if it does at all?

Without looking it up (thus I could easily be proved wrong): My
assumption is that the active sessions are in memory. Is there any
particular reason why you'd expect them on disk?

Olaf


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