Csaba Varga created JCR-4366:
--------------------------------
Summary: TransientRepository can shut down early when
Session.impersonate() is used
Key: JCR-4366
URL: https://issues.apache.org/jira/browse/JCR-4366
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-core
Affects Versions: 2.17.5
Reporter: Csaba Varga
The org.apache.jackrabbit.core.TransientRepository class assumes that the only
way to open a new Session is the login() method, and only monitors calls to
this method when tracking open sessions and deciding when to shut down.
There is, however, a second way of opening a new Session, by calling
Session.impersonate(). TransientRepository has no knowledge of such Session
instances, and will shut down when only impersonated sessions remain open. This
doesn't happen in practice, but can happen during unit testing scenarios where
only a small number of sessions is active.
This can be worked around by wrapping the returned Session instances into an
instance that can monitor impersonate() calls and notify the repository about
successful impersonations. It also needs to wrap the result of impersonate()
because it's allowed to further impersonate an impersonated session. I'm not
familiar with the code base, though, so there may be a better way to get
notified about impersonation calls.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)