[MGNLTOOLS-58] Tools -> Repository Tools - Error occurred during garbage collector command execution. Created: 08/May/13  Updated: 01/Oct/13  Resolved: 30/Sep/13

Status: Closed
Project: Repository Tools
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 1.2.2

Type: Bug Priority: Neutral
Reporter: Tom Wespi Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: versioning
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

http://demoauthor.magnolia-cms.com


Attachments: PNG File Screen Shot 2013-05-08 at 09.18.22.png    
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   
  • Garbage collection command throws:
Error occurred during garbage collector command execution. 
(info.magnolia.cms.core.version.MgnlVersioningSession cannot be cast to org.apache.jackrabbit.core.SessionImpl)
  • Purge versions command throws:
Error occurred during garbage collector command execution. (Custom access managers are no longer supported. Use Repository level security checks instead.)


 Comments   
Comment by Jonas Mende [X] (Inactive) [ 10/Sep/13 ]

Got the same Error. But we really needed to invoke the JCR garbage collection. What we did is invoking the garbage collector programmatically, which threw the same Error because the original session is wrapped by several instances of info.magnolia.jcr.wrapper.DelegateSessionWrapper. What we then did was unwrapping all wrappers and calling the garbage collection on the original session:

Session session = MgnlContext.getJCRSession("media");
while(session instanceof DelegateSessionWrapper)
session = ((DelegateSessionWrapper)session).getWrappedSession();

GarbageCollector gc = ((SessionImpl)session).createDataStoreGarbageCollector();
gc.mark();
gc.sweep();

Maybe this helps someone facing the same issue. For us it was very important, because like 5 Gigabytes of Data was obsolete and removed from the JCR, but still existed in the Datastore.

Comment by Ondrej Chytil [ 27/Sep/13 ]

"Clear all repositories" is still failing.

Comment by Jan Haderka [ 30/Sep/13 ]

What if session was not wrapped? If we stop using wrapper or someone manages to somehow pass in unwrapped session the getNested... method would return null and the follow up code would fail on NPE. Can we add check for null in the code and return original session in such case?

Comment by Roman Kovařík [ 30/Sep/13 ]
    private SessionImpl getNestedSessionImpl(Session session) {
        while (session instanceof DelegateSessionWrapper) {
            session = ((DelegateSessionWrapper) session).getWrappedSession();
        }
        return (SessionImpl) session;
    }

Doesn't it return SessionImpl in such case?

Comment by Jan Haderka [ 30/Sep/13 ]

yes it does ... except for one case - if I have session whose wrappedSession is null; In this case I would set session to null, the next iteration will break since while condition is not satisfied anymore and you end up returning null.

Generated at Mon Feb 12 10:40:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.