tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: HttpSessionListener: Negative session count
Date Tue, 12 Aug 2003 12:48:41 GMT

I would mention one other possibility, unrelated to synchronization,
which may cause this behavior.

If your session listener simply increments a counter on every
sessionCreated() and decrements the counter on every sessionDestroyed(),
it is vulnerable to this behavior.

When the server is restarted, if there are active sessions they are
persisted by default.  Then the server comes back up, and all these
sessions are active, without a session created event, so your listener
has a counter value of 0, but there are actually >0 active sessions.
When these are destroyed as usual, sessionDestroyed() will be called for
them, decrementing your counter and resulting in a negative value.

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: Christian Hauser []
>Sent: Tuesday, August 12, 2003 5:02 AM
>To: Tomcat Users List
>Subject: Re: HttpSessionListener: Negative session count
>Thank you very much, Ralph.
>   Regards, Christian
>Ralph Einfeldt wrote:
>> You don't need the useBean.
>> A bean with session scope doesn't make sense at all,
>> if you want to access the methods through an object
>> you can make the object application global.
>> Or you can make sessionCreated/sessionDestroyed
>> static and just call them through the class.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

View raw message