Re: Tomcat clustering session attribute is changed without request
Hi, thx for the response. Yes, it's ok for me that sessions are not expired(session continue to live on another node) and onsessiondestroyed is not called when one node is stopped. The actual reason why i asked this question was that many folks complained that tomcat always fired onsessiondestroyed on stop and there were no an easy way to disable such behavior. P.S somebody please answer to my questions in my previous mail:) thanks! Sent from my iPad On 27.10.2011, at 18:43, "Christopher Schultz" wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Paul, > > On 10/24/2011 7:28 AM, Hodchenkov, Paul wrote: >> 2) AFAIK tomcat fires onSessionDestroyed event when some node in >> cluster is stopped gracefully. However, in my environment I don't >> observe such behavior. > > Is that really what you want? Taking a server out of the cluster will > expire every session in the cluster, which is usually NOT what you want > to do. > >> Does expireSessionsOnShutdown parameter in Delta Manager, has >> something with it? > > If you set that to "true", then you'll get the (probably unwanted) > behavior described above. > > - -chris > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.10 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAk6pe+oACgkQ9CaO5/Lv0PBhZACgrjrDtl8U1D8F9aCZGYWCSosh > uIAAnA23e4+VgG0slBbubjaRWA/u1SMi > =8LdW > -END PGP SIGNATURE- > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat clustering session attribute is changed without request
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul, On 10/24/2011 7:28 AM, Hodchenkov, Paul wrote: > 2) AFAIK tomcat fires onSessionDestroyed event when some node in > cluster is stopped gracefully. However, in my environment I don't > observe such behavior. Is that really what you want? Taking a server out of the cluster will expire every session in the cluster, which is usually NOT what you want to do. > Does expireSessionsOnShutdown parameter in Delta Manager, has > something with it? If you set that to "true", then you'll get the (probably unwanted) behavior described above. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6pe+oACgkQ9CaO5/Lv0PBhZACgrjrDtl8U1D8F9aCZGYWCSosh uIAAnA23e4+VgG0slBbubjaRWA/u1SMi =8LdW -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat clustering session attribute is changed without request
Hi all, So I was not able to call cluster valve from the application, but I believe a http call to localhost with the same session id can do a trick(yeah, not an elegant solution :) ). However, it would be fine is somebody can clarify my another questions about tomcatssessions: 1) When using clustering with DeltaManager tomcat fires onSessionCreated,onSessionDestroyed on every node and when node joins the cluster(for every session). However, when single tomcat is configured with default session persistence then onSessionCreated event is fired only when this session is accessed after restart(all session attributes are restored correctly). Is there any way to force to restore all sessions after restart? One solution is to put sessions info to database, but : a) it will not work when 'clustering with DeltaManager' will be used later (database is not required in such case) b) there is no access to HttpSession object and it is not possible to invalidate user sessions 2) What will happen with HttpSession reference which is hold in application memory (ConcurrentMap) when tomcat decides to serialize it to FS without stopping the tomcat (for example running out of memory). Will call to HttpSession.getAttribute fail or tomcat will deserialize the session behind the scenes? Thanks! -Original Message- From: Ronald Klop (Mailing List) [mailto:ronald-mailingl...@base.nl] Sent: Tuesday, October 25, 2011 1:04 PM To: Tomcat Users List Subject: RE: Tomcat clustering session attribute is changed without request Hi, Replication of the attributes is done by the cluster valve. http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-valve.html If you manage to call that code from your own application, than you can do what you want. But that is not default functionality of Tomcat. You have to make it yourself. Ronald. Op dinsdag, 25 oktober 2011 09:44 schreef "Hodchenkov, Paul" : > > > Hi All, > I have used http://code.google.com/p/psi-probe/ to debug session replication. > So HttpSession attribute is NOT replicated when it is changed without http > request. It's value is changed only on the local tomcat. > However, when attribute is changed with http request - everything works fine. > So, is there any way to force the replication of HttpSession? > -Original Message- > From: Pid [mailto:p...@pidster.com] > Sent: Monday, October 24, 2011 4:08 PM > To: Tomcat Users List > Subject: Re: Tomcat clustering session attribute is changed without request > > On 24/10/2011 14:05, Hodchenkov, Paul wrote: > > Hi, > > Thanks for the reply! > > -> What does 'stores session map in memory' actually mean? > > It's ConcurrentMap map which is filled by > HttpListener. I can access session attributes of any user using this approach. > > Does changes to attributes in HttpSession cause a replication in this case? > > Don't know, probably. > > > What is the benefit of using JMX connection to access the session instead > of HttpListener in this case? > > It means you don't have to jump through hoops to access something that is > already accessible elsewhere. > > > p > > > -Original Message- > > From: Pid [mailto:p...@pidster.com] > > Sent: Monday, October 24, 2011 3:59 PM > > To: Tomcat Users List > > Subject: Re: Tomcat clustering session attribute is changed without > > request > > > > On 24/10/2011 11:55, Hodchenkov, Paul wrote: > >> Hi all, > >> I have configured tomcat 7 cluster by using [1] with DeltaManager and it > works fine. > >> However I have the following 2 questions: > >> > >> 1) My application stores session map in memory(admin can force > logout of any user and change some session attribute). Will this session > attribute be replicated if it is changed without tomcat http request (changed > by backend task for example)? > > > > What does 'stores session map in memory' actually mean? > > > > Instead of copying session objects around the place, why not just use the > JMX API and the operations on the Manager MBean? > > > > Catalina:type=Manager,context=/myapp,host=localhost > > > > > > p > > > >> 2) It's seems that expireSessionsOnShutdown=false in DeltaManager > can solve the problem with > http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? > >> [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html > >> > >> Best Regards, > >> Paul Hodchenkov > >> Senior Java developer, Oxagile > >> Skype: paul.ho
RE: Tomcat clustering session attribute is changed without request
Hi, Replication of the attributes is done by the cluster valve. http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-valve.html If you manage to call that code from your own application, than you can do what you want. But that is not default functionality of Tomcat. You have to make it yourself. Ronald. Op dinsdag, 25 oktober 2011 09:44 schreef "Hodchenkov, Paul" : Hi All, I have used http://code.google.com/p/psi-probe/ to debug session replication. So HttpSession attribute is NOT replicated when it is changed without http request. It's value is changed only on the local tomcat. However, when attribute is changed with http request - everything works fine. So, is there any way to force the replication of HttpSession? -Original Message- From: Pid [mailto:p...@pidster.com] Sent: Monday, October 24, 2011 4:08 PM To: Tomcat Users List Subject: Re: Tomcat clustering session attribute is changed without request On 24/10/2011 14:05, Hodchenkov, Paul wrote: > Hi, > Thanks for the reply! > -> What does 'stores session map in memory' actually mean? > It's ConcurrentMap map which is filled by HttpListener. I can access session attributes of any user using this approach. > Does changes to attributes in HttpSession cause a replication in this case? Don't know, probably. > What is the benefit of using JMX connection to access the session instead of HttpListener in this case? It means you don't have to jump through hoops to access something that is already accessible elsewhere. p > -Original Message- > From: Pid [mailto:p...@pidster.com] > Sent: Monday, October 24, 2011 3:59 PM > To: Tomcat Users List > Subject: Re: Tomcat clustering session attribute is changed without > request > > On 24/10/2011 11:55, Hodchenkov, Paul wrote: >> Hi all, >> I have configured tomcat 7 cluster by using [1] with DeltaManager and it works fine. >> However I have the following 2 questions: >> >> 1) My application stores session map in memory(admin can force logout of any user and change some session attribute). Will this session attribute be replicated if it is changed without tomcat http request (changed by backend task for example)? > > What does 'stores session map in memory' actually mean? > > Instead of copying session objects around the place, why not just use the JMX API and the operations on the Manager MBean? > > Catalina:type=Manager,context=/myapp,host=localhost > > > p > >> 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can solve the problem with http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? >> [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html >> >> Best Regards, >> Paul Hodchenkov >> Senior Java developer, Oxagile >> Skype: paul.hodchenkov >> Email: mailto:paul.hodchen...@oxagile.com >> >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat clustering session attribute is changed without request
Hi All, I have used http://code.google.com/p/psi-probe/ to debug session replication. So HttpSession attribute is NOT replicated when it is changed without http request. It's value is changed only on the local tomcat. However, when attribute is changed with http request - everything works fine. So, is there any way to force the replication of HttpSession? -Original Message- From: Pid [mailto:p...@pidster.com] Sent: Monday, October 24, 2011 4:08 PM To: Tomcat Users List Subject: Re: Tomcat clustering session attribute is changed without request On 24/10/2011 14:05, Hodchenkov, Paul wrote: > Hi, > Thanks for the reply! > -> What does 'stores session map in memory' actually mean? > It's ConcurrentMap map which is filled by HttpListener. > I can access session attributes of any user using this approach. > Does changes to attributes in HttpSession cause a replication in this case? Don't know, probably. > What is the benefit of using JMX connection to access the session instead of > HttpListener in this case? It means you don't have to jump through hoops to access something that is already accessible elsewhere. p > -Original Message- > From: Pid [mailto:p...@pidster.com] > Sent: Monday, October 24, 2011 3:59 PM > To: Tomcat Users List > Subject: Re: Tomcat clustering session attribute is changed without > request > > On 24/10/2011 11:55, Hodchenkov, Paul wrote: >> Hi all, >> I have configured tomcat 7 cluster by using [1] with DeltaManager and it >> works fine. >> However I have the following 2 questions: >> >> 1) My application stores session map in memory(admin can force logout >> of any user and change some session attribute). Will this session attribute >> be replicated if it is changed without tomcat http request (changed by >> backend task for example)? > > What does 'stores session map in memory' actually mean? > > Instead of copying session objects around the place, why not just use the JMX > API and the operations on the Manager MBean? > > Catalina:type=Manager,context=/myapp,host=localhost > > > p > >> 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can >> solve the problem with >> http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? >> [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html >> >> Best Regards, >> Paul Hodchenkov >> Senior Java developer, Oxagile >> Skype: paul.hodchenkov >> Email: mailto:paul.hodchen...@oxagile.com >> >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat clustering session attribute is changed without request
On 24/10/2011 14:05, Hodchenkov, Paul wrote: > Hi, > Thanks for the reply! > -> What does 'stores session map in memory' actually mean? > It's ConcurrentMap map which is filled by HttpListener. > I can access session attributes of any user using this approach. > Does changes to attributes in HttpSession cause a replication in this case? Don't know, probably. > What is the benefit of using JMX connection to access the session instead of > HttpListener in this case? It means you don't have to jump through hoops to access something that is already accessible elsewhere. p > -Original Message- > From: Pid [mailto:p...@pidster.com] > Sent: Monday, October 24, 2011 3:59 PM > To: Tomcat Users List > Subject: Re: Tomcat clustering session attribute is changed without request > > On 24/10/2011 11:55, Hodchenkov, Paul wrote: >> Hi all, >> I have configured tomcat 7 cluster by using [1] with DeltaManager and it >> works fine. >> However I have the following 2 questions: >> >> 1) My application stores session map in memory(admin can force logout >> of any user and change some session attribute). Will this session attribute >> be replicated if it is changed without tomcat http request (changed by >> backend task for example)? > > What does 'stores session map in memory' actually mean? > > Instead of copying session objects around the place, why not just use the JMX > API and the operations on the Manager MBean? > > Catalina:type=Manager,context=/myapp,host=localhost > > > p > >> 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can >> solve the problem with >> http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? >> [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html >> >> Best Regards, >> Paul Hodchenkov >> Senior Java developer, Oxagile >> Skype: paul.hodchenkov >> Email: mailto:paul.hodchen...@oxagile.com >> >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > signature.asc Description: OpenPGP digital signature
RE: Tomcat clustering session attribute is changed without request
Hi, Thanks for the reply! -> What does 'stores session map in memory' actually mean? It's ConcurrentMap map which is filled by HttpListener. I can access session attributes of any user using this approach. Does changes to attributes in HttpSession cause a replication in this case? What is the benefit of using JMX connection to access the session instead of HttpListener in this case? -Original Message- From: Pid [mailto:p...@pidster.com] Sent: Monday, October 24, 2011 3:59 PM To: Tomcat Users List Subject: Re: Tomcat clustering session attribute is changed without request On 24/10/2011 11:55, Hodchenkov, Paul wrote: > Hi all, > I have configured tomcat 7 cluster by using [1] with DeltaManager and it > works fine. > However I have the following 2 questions: > > 1) My application stores session map in memory(admin can force logout of > any user and change some session attribute). Will this session attribute be > replicated if it is changed without tomcat http request (changed by backend > task for example)? What does 'stores session map in memory' actually mean? Instead of copying session objects around the place, why not just use the JMX API and the operations on the Manager MBean? Catalina:type=Manager,context=/myapp,host=localhost p > 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can > solve the problem with > http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? > [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html > > Best Regards, > Paul Hodchenkov > Senior Java developer, Oxagile > Skype: paul.hodchenkov > Email: mailto:paul.hodchen...@oxagile.com > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat clustering session attribute is changed without request
On 24/10/2011 11:55, Hodchenkov, Paul wrote: > Hi all, > I have configured tomcat 7 cluster by using [1] with DeltaManager and it > works fine. > However I have the following 2 questions: > > 1) My application stores session map in memory(admin can force logout of > any user and change some session attribute). Will this session attribute be > replicated if it is changed without tomcat http request (changed by backend > task for example)? What does 'stores session map in memory' actually mean? Instead of copying session objects around the place, why not just use the JMX API and the operations on the Manager MBean? Catalina:type=Manager,context=/myapp,host=localhost p > 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can > solve the problem with > http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? > [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html > > Best Regards, > Paul Hodchenkov > Senior Java developer, Oxagile > Skype: paul.hodchenkov > Email: mailto:paul.hodchen...@oxagile.com > > signature.asc Description: OpenPGP digital signature
RE: Tomcat clustering session attribute is changed without request
Hi, --> Changes in the session are only replicated at the end of a request. 1)So is there any way to 'force' replication if HttpSession was changed without http request? -->2. I don't understand your question. 2) AFAIK tomcat fires onSessionDestroyed event when some node in cluster is stopped gracefully. However, in my environment I don't observe such behavior. Does expireSessionsOnShutdown parameter in Delta Manager, has something with it? -Original Message- From: Ronald Klop (Mailing List) [mailto:ronald-mailingl...@base.nl] Sent: Monday, October 24, 2011 2:20 PM To: Tomcat Users List Subject: Re: Tomcat clustering session attribute is changed without request Op maandag, 24 oktober 2011 12:55 schreef "Hodchenkov, Paul" : > > > > Hi all, > I have configured tomcat 7 cluster by using [1] with DeltaManager and it > works fine. > However I have the following 2 questions: > > 1) My application stores session map in memory(admin can force logout > of any user and change some session attribute). Will this session attribute > be replicated if it is changed without tomcat http request (changed by > backend task for example)? > > 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can > solve the problem with > http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? > [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html > > Best Regards, > Paul Hodchenkov > Senior Java developer, Oxagile > Skype: paul.hodchenkov > Email: mailto:paul.hodchen...@oxagile.com > > > > > > Hi, 1. Changes in the session are only replicated at the end of a request. BTW: My experience with holding references to Sessions in your own map is that it is harder than you think. It is more easy to create a map with blocked userids and block those users with a filter. 2. I don't understand your question. Ronald. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat clustering session attribute is changed without request
Op maandag, 24 oktober 2011 12:55 schreef "Hodchenkov, Paul" : Hi all, I have configured tomcat 7 cluster by using [1] with DeltaManager and it works fine. However I have the following 2 questions: 1) My application stores session map in memory(admin can force logout of any user and change some session attribute). Will this session attribute be replicated if it is changed without tomcat http request (changed by backend task for example)? 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can solve the problem with http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html Best Regards, Paul Hodchenkov Senior Java developer, Oxagile Skype: paul.hodchenkov Email: mailto:paul.hodchen...@oxagile.com Hi, 1. Changes in the session are only replicated at the end of a request. BTW: My experience with holding references to Sessions in your own map is that it is harder than you think. It is more easy to create a map with blocked userids and block those users with a filter. 2. I don't understand your question. Ronald.
Tomcat clustering session attribute is changed without request
Hi all, I have configured tomcat 7 cluster by using [1] with DeltaManager and it works fine. However I have the following 2 questions: 1) My application stores session map in memory(admin can force logout of any user and change some session attribute). Will this session attribute be replicated if it is changed without tomcat http request (changed by backend task for example)? 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can solve the problem with http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html Best Regards, Paul Hodchenkov Senior Java developer, Oxagile Skype: paul.hodchenkov Email: mailto:paul.hodchen...@oxagile.com