Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tomcat comet + session support fails to restore old session value on cancel/resume #950

Closed
markathomas opened this issue Mar 8, 2013 · 8 comments
Labels

Comments

@markathomas
Copy link
Contributor

With the following setup Atmosphere fails to restore the HTTP session timeout after a connection is canceled or resumed:
[] Tomcat 7 >= 7.0.33
[] Tomcat7CometSupport
[] org.apache.catalina.valves.CometConnectionManagerValve enabled in context
[] org.atmosphere.cpr.sessionSupport=true
[] Atmosphere 1.0.9+
[] Atmosphere GWT extension
The issue has to do with the SessionTimeoutRestorer object's requestCount. The restore only resets the timeout if requestCount == 0; however, this is not what I am observing as after the request was resumed I noticed that requestCount == 19 (see attached image) and thus the old timeout is not being restored which causes the HTTP session to never timeout. Turning off sessionSupport in web.xml 'fixes' this issue.
sessionRestorer

More info:
During testing and debugging I would close a browser window and notice that Tomcat7CometSupport would receive a comet BEGIN event instead of a RESUME or CLIENT_DISCONNECT and thus the suspended method would be called. The code progressed to AtmosphereGwtHandler which calls suspend on GwtAtmosphereResourceImpl which calls suspend on AtmosphereResourceImpl which returns an action with type SUSPENED. This is not what I would expect.

@markathomas
Copy link
Contributor Author

Another way to determine if the Comet connection is dead to Tomcat is to listen for the removal of the session attribute named 'org.apache.tomcat.comet.connectionList'. CometConnectionManagerValve adds this attribute on connection initiation and removes it on termination, error, or timeout.

@jfarcand
Copy link
Member

Salut, Thanks for this nice explanation. Before I investigate more, can you remove the valve and see if that help? The fact that you are receiving a BEGIN when closing the tabs sound strange, e.g it should receive an END not a BEGIN.

Thanks!

@markathomas
Copy link
Contributor Author

Yes, if I remove sessionSupport or explicitly set it to false (the default)
the problem goes away.

Regards,

Mark Thomas
spatialguru.net@gmail.com
205.529.9013

"Commit to the Lord whatever you do,
and your plans will succeed." - Proverbs 16:3

On Mon, Mar 11, 2013 at 1:51 PM, Jeanfrancois Arcand <
notifications@github.com> wrote:

Salut, Thanks for this nice explanation. Before I investigate more, can
you remove the valve and see if that help? The fact that you are receiving
a BEGIN when closing the tabs sound strange, e.g it should receive an END
not a BEGIN.

Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/950#issuecomment-14732728
.

@jfarcand
Copy link
Member

Mark, do you have enableProtocol configured to true on the client side? I suspect no, but just double checking.

@markathomas
Copy link
Contributor Author

Not that I am aware of; I am using the GWT AtmosphereClient

Regards,

Mark Thomas
spatialguru.net@gmail.com
205.529.9013

"Commit to the Lord whatever you do,
and your plans will succeed." - Proverbs 16:3

On Tue, Mar 26, 2013 at 7:40 AM, Jeanfrancois Arcand <
notifications@github.com> wrote:

Mark, do you have enableProtocol configured to true on the client side? I
suspect no, but just double checking.


Reply to this email directly or view it on GitHubhttps://github.com//issues/950#issuecomment-15455625
.

@cwellekoetter
Copy link

I've got the same problem:
[] Tomcat 7 = 7.0.35
[] Tomcat7CometSupport
[] org.atmosphere.cpr.sessionSupport=true
[] Atmosphere 1.0.10
[] Wicket Atmosphere integration

As Mark already mentioned, this problem has to do with the SessionTimeoutRestorer object and the request count.

I integrated the wicket application by using the ReflectorServletProcessor as the AtmosphereHandler on the ROOT-Context.
Every request from the client to the Wicket application increases the requestCount Integer on the SessionTimeoutRestorer, allthough it is not a websocket request. So the sessionTimeout gets never restored and we get infinite HttpSessions.
Simply deactivating 'org.atmosphere.cpr.sessionSupport' is not an option for us, as the wicket integration would not be useable any more.

@jfarcand
Copy link
Member

jfarcand commented May 6, 2013

@cwellekoetter Agree...except it seems to be a bug in Tomcat, not in Atmosphere so I need to find a way to hack Tomcat. Will give a try this week. You are using 1.0.x, right?

jfarcand added a commit that referenced this issue May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
@jfarcand
Copy link
Member

jfarcand commented May 6, 2013

@markathomas @cwellekoetter Please test 1.0.13 :-)

@jfarcand jfarcand closed this as completed May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
jfarcand added a commit that referenced this issue May 6, 2013
@jfarcand jfarcand reopened this May 10, 2013
jfarcand added a commit that referenced this issue May 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants