eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
158 stars 107 forks source link

Synchronizing on the session object could be ineffectual due to the servlet implentation not providing reference stability #5380

Closed VsevolodGolovanov closed 4 months ago

VsevolodGolovanov commented 6 months ago

Mojarra synchronizes on the session object in some places, but at least Undertow 2.0.15.Final returns a different instance (wrapper) from HttpServletRequest#getSession for every request in the same session. A simple text search of "synchronized (ses" in mojarra-2.3.21-RELEASE sources yields:

\impl\src\main\java\com\sun\faces\application\view\ViewScopeContextManager.java
\impl\src\main\java\com\sun\faces\renderkit\ServerSideStateHelper.java
\test\servlet30-isolated\cactus\src\main\java\com\sun\faces\application\DeprStateManagerImpl.java

This is issue is a follow up to this.

mnriem commented 6 months ago

@VsevolodGolovanov Can you create a PR for the suggested changes?

BalusC commented 4 months ago

I prepped a PR for 4.0.

Feel free to backport for 2.3.

pizzi80 commented 4 months ago

I don't know if someone can help... AFAYK:

Does this also apply to Tomcat?

Can this create a race condition with ajax requests backed by ViewScoped beans?

I'm experiencing some very strange hanging threads on POST (ajax) requests on Tomcat with no visible UI error and no exceptions on the server log.