Uploaded image for project: 'Magnolia Groovy Module'
  1. Magnolia Groovy Module
  2. MGNLGROOVY-157

MgnlGroovyConsole.evaluate(InputStream, String, Writer) leaks sessions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Outdated
    • Neutral
    • None
    • 2.5
    • None

    Description

      Despite the fact method is now deprecated, it should close the sessions it creates, which it currently does not thus resulting in logs like:

      2016-11-19 04:00:44,782 WARN org.apache.jackrabbit.core.SessionImpl : Unclosed session detected. The session was opened here: (uri:)
      java.lang.Exception: Stack Trace
      at org.apache.jackrabbit.core.SessionImpl.(SessionImpl.java:222)
      at org.apache.jackrabbit.core.SessionImpl.(SessionImpl.java:239)
      at org.apache.jackrabbit.core.XASessionImpl.(XASessionImpl.java:101)
      at org.apache.jackrabbit.core.RepositoryImpl.createSessionInstance(RepositoryImpl.java:1613)
      at org.apache.jackrabbit.core.RepositoryImpl.createSession(RepositoryImpl.java:956)
      at org.apache.jackrabbit.core.RepositoryImpl.login(RepositoryImpl.java:1501)
      at org.apache.jackrabbit.core.jndi.BindableRepository.login(BindableRepository.java:162)
      at info.magnolia.repository.DefaultRepositoryManager.getSession(DefaultRepositoryManager.java:303)
      at info.magnolia.context.DefaultRepositoryStrategy.internalGetSession(DefaultRepositoryStrategy.java:61)
      at info.magnolia.context.AbstractRepositoryStrategy.getSession(AbstractRepositoryStrategy.java:75)
      at info.magnolia.module.groovy.console.MgnlGroovyConsoleContext.getJCRSession(MgnlGroovyConsoleContext.java:138)
      at info.magnolia.context.MgnlContext.getJCRSession(MgnlContext.java:664)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.__invoke(DelegatingMethodAccessorImpl.java:43)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:148)
      at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122)
      at Script1.run(Script1.groovy:14)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:598)
      

      In case abovi is too convoluted or unclear, here's more detailed explanation:

      1. evaluate method wraps current context in MgnlGroovyConsoleContext
      2. MgnlGroovyConsoleContext overrides getRepositoryStrategy() method of AbstractContext
      3. in overridden getRepositoryStrategy() new RepositoryStrategy is created (when super class doesn't provide any (since *super* class here is the instance of newly created context, not the wrapped context)
      4. this newly created strategy is not registered nor monitored anywhere thus all the sessions created with it will be abandoned upon finishing processing of the request and left unclosed

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              had Jan Haderka
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD