You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2008/09/22 10:32:44 UTC

[jira] Updated: (JCR-1216) Unreferenced sessions should get garbage collected

     [ https://issues.apache.org/jira/browse/JCR-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller updated JCR-1216:
--------------------------------

    Attachment: userSessionPatch.txt

This patch adds a UserSessionImpl (user facing session) that acts as a proxy/wrapper for a SessionImpl. The patch is just for reference. I don't plan to commit it, because there are some problems. For example if a session is not referenced any longer, but one of its nodes is, then the session can still get garbage (but should not).

I will try the original idea: Instead of referencing SessionImpl directly, use WeakReference objects.

> Unreferenced sessions should get garbage collected
> --------------------------------------------------
>
>                 Key: JCR-1216
>                 URL: https://issues.apache.org/jira/browse/JCR-1216
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>         Attachments: userSessionPatch.txt
>
>
> If an application opens many sessions and doesn't close them, they are never garbage collected. After some time, the virtual machine will run out of memory. This code will run out of memory after a few thousand logins:
> Repository rep = new TransientRepository();
> for (int i = 0; ; i++) {
>   rep.login(new SimpleCredentials("", new char[0]));
> }
> Using a finalizer to close SessionImpl doesn't work, because it seems there are references from the (hard referenced part of the cache) to the SessionImpl objects. Maybe it is possible to remove those references, or change them to weak references.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.