[GLASSFISH-18676] Http Session gets invalidated Created: 02/May/12  Updated: 08/Apr/13  Resolved: 08/Apr/13

Status: Closed
Project: glassfish
Component/s: grizzly-kernel
Affects Version/s: 3.1.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: vasim Assignee: oleksiys
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

glassfish 3.1.2 Release, Windows 7, FF or IE.

Attachments: JPEG File invalid_session_unsubscribe.jpg     Java Archive File web-core.jar    


We have an issue in a Atmosphere application using streaming or long-polling.
After the js code is subscribing for a request then the server-side code is doing a request.suspend() and then a broadcasting.
In the time of broadcasting the suspend call seems is not completed and then the glassfish thrown error 503 and this error invalidates the htt session of the client.
Very hard for me to provide a sample.
I advice tzo use the atmosphere-pubsub sample project.
The idea is if you don't have authentication in the project like in the atmosphere-pubsub you cannot see the error.
In this sample project if authentication will be added then should be reproducable. Eventually adding broadcasting directly after suspend will allow to reproduce the rror easy.
See the thread when I discussed this error with Jeanfrancois::

Unfortunately my app I cannot deliver because of the complexity(app using a db connection) and license reasons.

Comment by Ryan Lubke [ 02/May/12 ]


Could you please back up your $GF_HOME/modules/web-core.jar and replace it with the web-core.jar I've attached to this issue? This should show us where the session is being invalidated from.


Comment by Ryan Lubke [ 07/May/12 ]

Hi Vasile,

Any update?

Comment by vasim [ 09/May/12 ]

Sorry for answering so late.
I was very busy.
The idea is I found a work around in the app to avoid this error.

Actually are 2 errors:
1. suspend and broadcasting one after another is generating the session invalidation. Here was helping a thread sleep after suspend.
The problem occured only if I used for brodcasting same request as for suspend.

2. throwing the error 503 in the web app is generating the session invalidation. The error 503 was thrown by Atmosphere and now we took it out. Actually in my opinion glassfish is here wrong implemented, why in this error case the session should be invalidated ? In the case the application is doing another request after such an error, then the seesion will be of course used and the app is not allowed to do anything any more. This means the app needs a new login and I don't find this normal.

You need some log files from me, in adition to this new informations ?

Comment by oleksiys [ 30/May/12 ]

Hi Vasile,

yes, pls. send GF server.log file, when session invalidation happens again.

Regarding point 1) you mentioned a thread.sleep... it might be a bug by design, cause in Grizzly Comet (Jeanfrancois has to know about that ) ) the actual "suspend" initialization happens after you exit Servlet.service(...) method. So if this initialization clashes w/ broadcaster thread - it may cause problems. IMO possible fix will include changes on both Grizzly and Atmosphere sides.



Comment by oleksiys [ 12/Jun/12 ]


changing the priority to major.
will appreciate if you can apply the patch and once the issue occurs provide resulting GF server.log file.


Generated at Sat Jul 04 14:34:56 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.