[MAGNOLIA-2099] context: system jcr sessions are not released after a request Created: 02/Apr/08  Updated: 23/Jan/13  Resolved: 23/Oct/12

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 3.5.4
Fix Version/s: 3.5.5, 3.6

Type: Bug Priority: Critical
Reporter: Philipp Bärfuss Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File MAGNOLIA-2099-3.5.patch    
Issue Links:
dependency
is depended upon by MAGNOLIA-2146 revert changes on SystemContext inter... Closed
is depended upon by MAGNOLIA-1998 Potential memory leak: investigation. 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   

The system repository session is nor released when the user context is released. I did not yet apply the following patch as it has consequences where ever a node reference is kept. An obvious example is the user object which keeps a reference to the user's node.

Here is the needed patch:

Index: /Users/philipp/checkout/magnolia/magnolia-core/src/main/java/info/magnolia/context/SystemContextImpl.java
===================================================================
--- /Users/philipp/checkout/magnolia/magnolia-core/src/main/java/info/magnolia/context/SystemContextImpl.java	(revision 14777)
+++ /Users/philipp/checkout/magnolia/magnolia-core/src/main/java/info/magnolia/context/SystemContextImpl.java	(working copy)
@@ -87,6 +87,7 @@
     }
 
     public void release() {
+        super.release();
         repositoryStrategyThreadLocal.set(null);
     }
 


 Comments   
Comment by Philipp Bracher [ 04/Apr/08 ]

We should not call super.release() as we only want to close the jcr session but not releasing the access manager

Comment by Philipp Bracher [ 23/Apr/08 ]

This patch contains the major changes I have done on the 3.5 branch. I will apply them on 3.6 and will only commit to 3.5 after they have proven to be robust enough.

I also added an MBean so that one can see the open sessions. On many places we keep a reference to a node (templates, trees, ...) so I had to create a LazyContentWrapper which refetches content if the original session has been closed.

Comment by Philipp Bracher [ 24/Apr/08 ]

I committed to the trunk (3.6). But now I have realized that this breaks all observation as it is tied to a session.

Perhaps we should go back to the former way of having single sessions for the system context.

Comment by Philipp Bracher [ 24/Apr/08 ]

Committed a temporary workaround for the observation (don't logout the sessions which do have listeners registered). Warn logs are written.

It is so sad that I decided to go home ;-(

Comment by Philipp Bracher [ 09/May/08 ]

I was able to backport the changes to 3.5

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