-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
After upgrading from Jetty 12.0.9 to 12.0.12 I get session expired exceptions for websocket handling #12121
Comments
Those are the same message. First flag I'm noticing is that you are attempting to work with http sessions from within WebSocket. HttpSession only works on HTTP, during HTTP, not after HTTP. |
Will look into this, I am bootstrapping Vaadin with Atmosphere running Jetty via Apache Felix Jetty 12 on Karaf. I did remember seeing that Vaadin is fetching session data out of attributes from a Felix HttpSessionWrapper class and I had to modify it because Felix was adding prefixes to the attributes causing Vaadin not to find the session data because it is accessing it directly, not via the Felix session wrapper. |
Note that with EE11, the Servlet 6.1 spec has a new feature that allows you to ask for an This is the new (From the Servlet Spec)
Jetty 12.1.x has already implemented See:
This would allow something like Vaadin and Atmosphere to access HttpSession instances from websocket. |
The odd thing is, I have a manually put together Karaf instance with Jetty 12.0.9 where Vaadin and Atmosphere works, now I am creating the feature KAR installer and it does not, producing below exception in a loop. Have to find the differences :) 2024-08-01T16:51:20,122 | DEBUG | CM Configuration Updater (ManagedService Update: pid=[org.apache.felix.http]) | AbstractSessionManager | 190 - org.eclipse.jetty.session - 12.0.9 | SessionManager default maxInactiveInterval=7200 |
Jetty 12.0.8 introduced Cross Context Dispatching (even across EE versions!) See:
But that had a bug in HttpSession handling of new/accessed that wasn't fixed until Jetty 12.0.12 (bug was present even if you didn't use RequestDispatcher) See:
Your code in 12.0.9 is likely accidentally relying on a buggy HttpSession behavior that didn't update the lifecycle properly and was fixed in 12.0.12. |
The problem is fixed with some better mods to the Felix HTTP Base module. |
Jetty version(s)
12.0.9 / 12.0.12
Jetty Environment
ee8
Java version/vendor
(use: java -version)
OpenJDK
OS type/version
Windows
Description
In 12.0.9 the Context gets wrapped in ee8 nested handler, in 12.0.12 it does not get wrapped:
12.0.12 : not upgraded method!=GET CoreContextRequest@69563023
12.0.9 : not upgraded method!=GET org.eclipse.jetty.ee8.nested.ContextHandler$CoreContextRequest@6c4e79c5
presumably resulting in the session expired exception because no session was found and the websocket gets closed.
Following exception occurs when using Jetty 12.0.12:
2024-08-01T14:42:59,930_ | DEBUG | qtp1474871727-483 | AbstractHandshaker | 186 - org.eclipse.jetty.websocket.core.server - 12.0.12 | not upgraded method!=GET CoreContextRequest@69563023{POST@5a9fe76a http://localhost:8181/twentythree/?v-r=uidl&v-uiId=17 HTTP/1.1}
2024-08-01T14:42:59,930 | DEBUG | qtp1474871727-483 | AbstractHandshaker | 186 - org.eclipse.jetty.websocket.core.server - 12.0.12 | not upgraded method!=GET CoreContextRequest@69563023{POST@5a9fe76a http://localhost:8181/twentythree/?v-r=uidl&v-uiId=17 HTTP/1.1}
2024-08-01T14:42:59,931 | DEBUG | qtp1474871727-483 | ServerRpcHandler | 130 - com.vaadin.flow.server - 23.5.2 | UI closed with a beacon request
2024-08-01T14:42:59,931 | DEBUG | qtp1474871727-483 | UidlWriter | 130 - com.vaadin.flow.server - 23.5.2 | * Creating response to client
2024-08-01T14:42:59,929 | DEBUG | qtp1474871727-485 | PushHandler | 130 - com.vaadin.flow.server - 23.5.2 | Session expired before push disconnect event was received
com.vaadin.flow.server.SessionExpiredException: null
at com.vaadin.flow.server.VaadinService.doFindOrCreateVaadinSession(VaadinService.java:906) ~[?:?]
at com.vaadin.flow.server.VaadinService.findOrCreateVaadinSession(VaadinService.java:842) ~[?:?]
at com.vaadin.flow.server.VaadinService.findVaadinSession(VaadinService.java:681) ~[?:?]
at com.vaadin.flow.server.communication.PushHandler.handleConnectionLost(PushHandler.java:363) ~[?:?]
at com.vaadin.flow.server.communication.PushHandler.connectionLost(PushHandler.java:325) ~[?:?]
at com.vaadin.flow.server.communication.PushAtmosphereHandler.onStateChange(PushAtmosphereHandler.java:55) ~[?:?]
at org.atmosphere.cpr.AsynchronousProcessor.invokeAtmosphereHandler(AsynchronousProcessor.java:540) ~[?:?]
at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:482) ~[?:?]
at org.atmosphere.cpr.AsynchronousProcessor.endRequest(AsynchronousProcessor.java:586) ~[?:?]
at org.atmosphere.websocket.DefaultWebSocketProcessor.close(DefaultWebSocketProcessor.java:652) ~[?:?]
at org.atmosphere.container.JSR356Endpoint.onClose(JSR356Endpoint.java:302) ~[?:?]
at org.eclipse.jetty.ee8.websocket.javax.common.JavaxWebSocketFrameHandler.notifyOnClose(JavaxWebSocketFrameHandler.java:263) ~[?:?]
at org.eclipse.jetty.ee8.websocket.javax.common.JavaxWebSocketFrameHandler.onClose(JavaxWebSocketFrameHandler.java:238) ~[?:?]
at org.eclipse.jetty.ee8.websocket.javax.common.JavaxWebSocketFrameHandler.onFrame(JavaxWebSocketFrameHandler.java:228) ~[?:?]
at org.eclipse.jetty.websocket.core.WebSocketCoreSession$IncomingAdaptor.onFrame(WebSocketCoreSession.java:680) ~[!/:12.0.12]
at org.eclipse.jetty.websocket.core.AbstractExtension.nextIncomingFrame(AbstractExtension.java:145) ~[!/:12.0.12]
at org.eclipse.jetty.websocket.core.internal.PerMessageDeflateExtension.nextIncomingFrame(PerMessageDeflateExtension.java:239) ~[!/:12.0.12]
at org.eclipse.jetty.websocket.core.util.DemandingFlusher.emitFrame(DemandingFlusher.java:143) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.internal.PerMessageDeflateExtension$IncomingFlusher.handle(PerMessageDeflateExtension.java:382) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.util.DemandingFlusher.process(DemandingFlusher.java:167) [!/:12.0.12]
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:262) [!/:12.0.12]
at org.eclipse.jetty.util.IteratingCallback.succeeded(IteratingCallback.java:401) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.util.DemandingFlusher.onFrame(DemandingFlusher.java:105) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.internal.PerMessageDeflateExtension.onFrame(PerMessageDeflateExtension.java:96) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.ExtensionStack.onFrame(ExtensionStack.java:113) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.WebSocketCoreSession.onFrame(WebSocketCoreSession.java:463) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.WebSocketConnection.onFrame(WebSocketConnection.java:254) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.WebSocketConnection.fillAndParse(WebSocketConnection.java:447) [!/:12.0.12]
at org.eclipse.jetty.websocket.core.WebSocketConnection.onFillable(WebSocketConnection.java:332) [!/:12.0.12]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322) [!/:12.0.12]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99) [!/:12.0.12]
at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) [!/:12.0.12]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:478) [!/:12.0.12]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:441) [!/:12.0.12]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:293) [!/:12.0.12]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:201) [!/:12.0.12]
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:311) [!/:12.0.12]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979) [!/:12.0.12]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209) [!/:12.0.12]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164) [!/:12.0.12]
at java.lang.Thread.run(Thread.java:833) [?:?]
In Jetty 12.0.9:
2024-08-01T13:44:33,696 | DEBUG | qtp1099831541-354 | AbstractHandshaker | 91 - org.eclipse.jetty.websocket.core.server - 12.0.9 | not upgraded method!=GET org.eclipse.jetty.ee8.nested.ContextHandler$CoreContextRequest@6c4e79c5
2024-08-01T13:44:33,696 | DEBUG | qtp1099831541-354 | AbstractHandshaker | 91 - org.eclipse.jetty.websocket.core.server - 12.0.9 | not upgraded method!=GET org.eclipse.jetty.ee8.nested.ContextHandler$CoreContextRequest@6c4e79c5
2024-08-01T13:44:33,698 | DEBUG | qtp1099831541-354 | UidlWriter | 164 - com.vaadin.flow.server - 23.5.1 | * Creating response to client
2024-08-01T13:44:33,698 | DEBUG | qtp1099831541-354 | AbstractSessionManager | 72 - org.eclipse.jetty.session - 12.0.9 | Complete called with session ManagedSession@f1feb25{id=node0q652rp1vgijk1h3enwgbm0kli0,x=node0q652rp1vgijk1h3enwgbm0kli0.node0,req=1,res=true}
2024-08-01T13:44:33,698 | DEBUG | qtp1099831541-354 | ManagedSession | 72 - org.eclipse.jetty.session - 12.0.9 | Session node0q652rp1vgijk1h3enwgbm0kli0 complete, active requests=0
2024-08-01T13:44:33,699 | DEBUG | qtp1099831541-354 | AbstractSessionManager | 72 - org.eclipse.jetty.session - 12.0.9 | Session node0q652rp1vgijk1h3enwgbm0kli0 no eviction
2024-08-01T13:44:33,699 | DEBUG | qtp1099831541-354 | SessionInactivityTimer | 72 - org.eclipse.jetty.session - 12.0.9 | (Re)starting timer for session node0q652rp1vgijk1h3enwgbm0kli0 at 7200000ms
2024-08-01T13:44:33,699 | DEBUG | qtp1099831541-354 | AbstractSessionDataStore | 72 - org.eclipse.jetty.session - 12.0.9 | Store: id=node0q652rp1vgijk1h3enwgbm0kli0, mdirty=true, dirty=true, lsave=1722512672457, period=0, elapsed=1242
2024-08-01T13:44:33,699 | DEBUG | qtp1099831541-354 | AbstractSessionCache | 72 - org.eclipse.jetty.session - 12.0.9 | Non passivating SessionDataStore, session in SessionCache only id=node0q652rp1vgijk1h3enwgbm0kli0
2024-08-01T13:44:33,894 | DEBUG | Thread-66 | UidlWriter | 164 - com.vaadin.flow.server - 23.5.1 | * Creating response to client
How to reproduce?
Very hard
The text was updated successfully, but these errors were encountered: