You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dominik Stadler <do...@dynatrace.com> on 2011/04/06 12:21:32 UTC

PersistentManager with FileStore reports "persistentManager.swapInInvalid"

Hi,

We are using an embedded instance of Tomcat and would like to use a FileStore for Session storage to keep memory requirements low while still allowing to have many sessions opened. This is a single tomcat instance, sharing sessions with other instances is not needed.

As I embed Tomcat, I have created the FileStore as follows:

  Context context = tomcat.addWebapp(contextRoot, webDir);

        tomcat.start();

        { // Override the default Manager and set a persistent manager which can store Sessions on disk
            PersistentManager manager = new PersistentManager();
              FileStore store = new FileStore();
              store.setDirectory(new File(workDir, "store").getAbsolutePath());
                  manager.setStore(store);
                  context.setManager(manager);
            manager.setMaxActiveSessions(-1);
            manager.setMaxIdleSwap(500);
            manager.setMinIdleSwap(200);
            manager.setMaxIdleBackup(400);
        }

As far as I understood documentation, this should allow me to have an unlimited number of sessions (while the session timeout of 30 minutes still applies), but swaps out the sessions at least after 500 seconds.

It basically works fine this way, only a limited number of sessions are held in memory, others are swapped out. The only issue is that I start getting the following log output frequently after aprox. half an hour when the first sessions are timing out:

2011-04-06 12:17:20 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:20 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:20 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:21 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid

When looking at the code in PersistentManager and StandardSession, I can not explain what this severe-log tries to tell me. It seems we get this for every session that is timing out after 30 minutes of inactivity. It seems the expiry-check marks the session as "invalid" which in turn causes the check in swapIn() to fail.

Now my question:


-          As it seems to work nevertheless, can I safely ignore this error message or does it indicate that I am doing something fundamentally wrong with PersistentManager and FileStore?


Thanks... Dominik

Dominik Stadler, Team Lead, R&D  dynaTrace<http://www.dynatrace.com/>, dominik.stadler@dynatrace.com<ma...@dynatrace.com>  Skype: stadler.dominik
dynaTrace<http://www.dynatrace.com/> >> Monitor. Resolve. Prevent. >> www.dynatrace.com<http://www.dynatrace.com/> | blog.dynatrace.com<http://blog.dynatrace.com/>


Re: PersistentManager with FileStore reports "persistentManager.swapInInvalid"

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dominik,

On 4/6/2011 6:21 AM, Dominik Stadler wrote:
> We are using an embedded instance of Tomcat and would like to use a
> FileStore for Session storage to keep memory requirements low while
> still allowing to have many sessions opened. This is a single tomcat
> instance, sharing sessions with other instances is not needed.
> 
> As I embed Tomcat, I have created the FileStore as follows:

I'm not sure that the embedded environment is relevant, but thanks for
providing your setup code.

> As far as I understood documentation, this should allow me to have
> an unlimited number of sessions (while the session timeout of 30 minutes
> still applies), but swaps out the sessions at least after 500 seconds.

> It basically works fine this way, only a limited number of sessions are held in memory, others are swapped out. The only issue is that I start getting the following log output frequently after aprox. half an hour when the first sessions are timing out:
> 
> 2011-04-06 12:17:20 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:20 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:20 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:21 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid
> 2011-04-06 12:17:22 Custome SEVERE  [PersistentManagerBase] persistentManager.swapInInvalid

It looks like Tomcat is missing some localized error message text for
your locale. What is your locale?

persistentManager.swapInInvalid is produced when a session loaded from
the store is determined to be invalid. I'm not sure why it's classified
as "severe", since this is a perfectly reasonable situation: the session
was persisted while it was valid, and then a request came in for that
session after it was invalidated. The persistent manager loads the
session from the store, sees that it's not valid (it has expired after
30 minutes or so) and emits this ("severe") error message.

I suspect that the persistent manager is working as you expect... just
generating error messages that are more alarming than they should be.

> When looking at the code in PersistentManager and StandardSession, I
> can not explain what this severe-log tries to tell me. It seems we
> get this for every session that is timing out after 30 minutes of
> inactivity. It seems the expiry-check marks the session as "invalid"
> which in turn causes the check in swapIn() to fail.

I agree with your analysis.

> As it seems to work nevertheless, can I safely ignore this error
> message or does it indicate that I am doing something fundamentally
> wrong with PersistentManager and FileStore?

I think you can probably ignore this error, though I'd like to hear some
commentary from others with more familiarity with the PersistentManager.
I would probably downgrade this message possibly to the DEBUG level,
though there may be a reason why PersistentManager flags this particular
issue for stores /other than/ FileStore.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2cmxUACgkQ9CaO5/Lv0PDE4QCffJ2LPJ756MLpjEKU1ccQGWuS
m1kAn01atqSlkgtGdsXLQ5xYr4DpdB7a
=yZyv
-----END PGP SIGNATURE-----

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