[MAGNOLIA-1758] WebcontextImpl stores a non-serializable jcr session into the httpsession Created: 08/Oct/07  Updated: 23/Jan/13  Resolved: 09/Oct/07

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 3.1 M3
Fix Version/s: 3.5 RC1

Type: Bug Priority: Blocker
Reporter: Fabrizio Giustina Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-1774 LogoutFilter should not set the conte... Closed
is related to MAGNOLIA-1775 WebContextImpl.logout() should not on... Closed
is related to MAGNOLIA-2385 SystemContentWrapper not serializable Closed
is related to MAGNOLIA-1614 Refactor magnolia Context class hiera... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Trying to enable session replication (<distributable/> in web.xml) doesn't work since WebcontextImpl.getRepositorySession() stores the current jcr session into the httpsession.

Magnolia dies at this error:
java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute
at info.magnolia.context.WebContextImpl.getRepositorySession(WebContextImpl.java:498)



 Comments   
Comment by Fabrizio Giustina [ 08/Oct/07 ]

Work started: at this moment every setAttribute() call with a non-serializable attribute gets logged and ignored. <distributable/> has been enabled in the sample webapp in order to properly test it.
Warning: trunk may be unstabled at this moment. Everything seems to work (apart from the added stacktraces), so probably we should just start from removing the session usage from webcontextImpl.

Comment by Philipp Bracher [ 09/Oct/07 ]

Wired this was solved by Sameer long time ago. As far I know we should store the mgnl hm in the session containing the jcr session as a transient field.

I can't see how we could avoid using the http session.

Comment by Fabrizio Giustina [ 09/Oct/07 ]

>As far I know we should store the mgnl hm in the session containing the jcr session as a transient field.

WebContextImpl was also storing the plain jcr (+ the non-serializable query manager) in different attributes, not sure when/how we lost Sameer patch but this is what we had in trunk :/

Comment by Fabrizio Giustina [ 09/Oct/07 ]

last patch committed to svn: now WebContext/AnonymousContext don't use anymore httpsessions for storing jcr sessions and don't keep anymore a single jcr session reused by different thread.
Context has a new release() method that takes care or releasing resources. In the webContext implementation jcr sessions are stored in request and closed at the end of the filter chain. All the usage of maps in AnonymousContext has been dropped.

So far so good, now we should see if this could affect performance and if we can have benefits from using a pool (should be pretty easy to implement a pool for anonymous context using commons-pool, we should try it and measure the result.

Comment by Philipp Bracher [ 11/Oct/07 ]

I think the biggest performance improvements were achieved by sharing the mgnl AccessManager.

Comment by Magnolia International [ 11/Oct/07 ]

fixed a bug when using virtualUriMapping (ie when filter chain is reset), where the context would be released to early (MgnlContext.getInstance() would throw an exception, because it had been set to null on an earlier call)

Generated at Mon Feb 12 03:30:02 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.