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
jetty, myfaces and weld: Expired session cleanup is failing: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped #6506
Comments
Looks like the session was destroyed during a HouseKeeper.scavenge() which occurs at a later time. Do you have an example project that can cause this? |
@38leinaD can you post a small, simple reproduction? Jetty uses a background thread to periodically search for From a first reading of the javadocs on the |
I have prepared a "small" reproducer: https://github.com/38leinaD/jetty-issue-reproducer-cleanup-session
After thinking about the problem some more, I am wondering if the rather special integration between jetty and weld could be part of the problem. I tried to preserve the structure in the reproducer. We are actually using WeldSE to boot up a CDI container and a managed bean from here starts Jetty (https://github.com/38leinaD/jetty-issue-reproducer-cleanup-session/blob/master/runtime/src/main/java/Starter.java#L11). I know that Weld will do some additional thingswhen started in EE mode. So, wondering if this could be related; and if so, what piece of integration-code might be missing to run here... @janbartel I only prepared a reproducer with myfaces. what do you have in mind regarding a reproducer without myfaces. A plain servelt with an injected @SessionScoped bean? Would that work? |
I now also created a small example using a servlet and a @SessionScoped bean and no myfaces. But i am not able to reproduce the issue here.
|
@38leinaD thanks for the reproduction test cases, so helpful! I actually converted them to maven too, to build a standard webapp that I could deploy, just to eliminate any possibility that your embedded code was involved in the problem (it wasn't). So, from following the stacktraces through the The problem appears to be when At this point we are well into So, my theory is that we are looking at some kind of mismatch between the |
Thanks @janbartel ! |
For those following this issue, it looks like this is a known problem for some versions of MyFaces: https://issues.apache.org/jira/browse/MYFACES-4382 |
Seems to be indeed fixed with myfaces 2.3.9. Will monitor it for a few days in our application and then close this. |
@38leinaD how did you go? Can we close this issue on the jetty side? |
Problem was no longer seen with latest myfaces version. |
Jetty version
We are using Jetty 9.4.42.v20210604 in combination with
Java version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment 18.9 (build 11.0.8+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode)
Question
We are seeing below exception for invalidated sessions and trying to make sense of it:
Essentially, as i understand it, there is a lingering invalid session that is cleand up by jetty. Jetty will inform MyFaces that the session is destroyed. MyFaces tries to do cleanup of the ViewScoped beans that are associated to the session. MyFaces is tracking these ViewScoped beans on a ViewScopeBeanHolder (SessionScoped bean); is trying to get a reference via CDI and CDI tells there is no active scope.
To me, it seems reasonable that there is no active scope on this cleanup thread. Who would have activated the session scope here? it would need to be the session scope that is associated with the session that is cleaned up.
Maybe someone can help shed some light on what is going on and who might be doing something wrong (maybe our integration between the three technologies is incomplete?). Is there some integrationcode between jetty/servlet and CDI not called/invoked/registered that would normally reactivate the SessionScope?
Any help, guess, comments welcome :-)
Thanks in Advance,
Daniel
The text was updated successfully, but these errors were encountered: