You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Radu Ana-Maria <ra...@gmail.com> on 2009/10/21 09:48:05 UTC

many sessions remain unclosed

hello,

I'm working with: jackrabbit 1.5.6 + postgresql 8.4 , and i found a little
problem in my code with unclosed session even if i do session.logout() for
each new session.

for example:

*sessionPPL = repository.login(credentials);
 workspaceList = sessionPPL.getWorkspace().getAccessibleWorkspaceNames();

for (String x : workspaceList ) {
   sessionInUse = repository.login(credentials, x);
   // and here i do something else.. like add some nodes etc.
 sessionInUse .save();
sessionInUse .logout();
}
sessionPPL .logout();*

and when i open the postgreSQL admin i see that i have more then 80 session
opend and not closed by jackrabbit.

--  sessionInUse .logout(); must stop the session opend in postgreSQL? or
not? if not, how can i stop this sessions from postgreSQL.

the api say:
*public void logout() -- Releases all resources associated with this
Session. This method should be called when a
Session is no longer needed.*

Any help would be greatful
Thanks,
ana r.

Re: many sessions remain unclosed

Posted by Guo Du <mr...@gmail.com>.
On Wed, Oct 21, 2009 at 10:31 AM, Jukka Zitting <ju...@gmail.com> wrote:
> I believe that the "10x" here was just a shorthand for "Thanks". :-)
Lesson learned.

10x :)

--Guo

Re: many sessions remain unclosed

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Wed, Oct 21, 2009 at 11:28 AM, Guo Du <mr...@gmail.com> wrote:
> On Wed, Oct 21, 2009 at 9:37 AM, Radu Ana-Maria <ra...@gmail.com> wrote:
>> 10x for the quick response.
>> well i can't hardly wait for jackrabbit 2.0.
>
> It might be wrong message for community that  jackrabbit 2.0 is 10x
> faster than  jackrabbit 1.x. In your case, the improvement may gained
> by configuration optimisation.

I believe that the "10x" here was just a shorthand for "Thanks". :-)

BR,

Jukka Zitting

Re: many sessions remain unclosed

Posted by Guo Du <mr...@gmail.com>.
On Wed, Oct 21, 2009 at 9:37 AM, Radu Ana-Maria <ra...@gmail.com> wrote:
> 10x for the quick response.
> well i can't hardly wait for jackrabbit 2.0.

It might be wrong message for community that  jackrabbit 2.0 is 10x
faster than  jackrabbit 1.x. In your case, the improvement may gained
by configuration optimisation.

-Guo

Re: many sessions remain unclosed

Posted by Radu Ana-Maria <ra...@gmail.com>.
10x for the quick response.
well i can't hardly wait for jackrabbit 2.0.

ana r.


On Wed, Oct 21, 2009 at 11:26 AM, Jukka Zitting <ju...@gmail.com>wrote:

> Hi,
>
> On Wed, Oct 21, 2009 at 9:48 AM, Radu Ana-Maria <ra...@gmail.com>
> wrote:
> > I'm working with: jackrabbit 1.5.6 + postgresql 8.4 , and i found a
> little
> > problem in my code with unclosed session even if i do session.logout()
> for
> > each new session.
> > [...]
> > and when i open the postgreSQL admin i see that i have more then 80
> session
> > opend and not closed by jackrabbit.
>
> Jackrabbit keeps a long-lived database connection for each workspace.
> That connection is shared among any number of JCR sessions that access
> the same workspace, so it is not considered a part of the resources
> associated with the JCR session.
>
> For example, if you open N connections to the same workspace, you'll
> only see one backend database connection open.
>
> Those workspace database connections will be closed when the entire
> repository gets closed.
>
> Note that the ongoing database connection pooling work targeted for
> Jackrabbit 2.0 will include a mechanism that will automatically close
> those backend connections once they've been unused for a while.
>
> BR,
>
> Jukka Zitting
>

Re: many sessions remain unclosed

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Wed, Oct 21, 2009 at 9:48 AM, Radu Ana-Maria <ra...@gmail.com> wrote:
> I'm working with: jackrabbit 1.5.6 + postgresql 8.4 , and i found a little
> problem in my code with unclosed session even if i do session.logout() for
> each new session.
> [...]
> and when i open the postgreSQL admin i see that i have more then 80 session
> opend and not closed by jackrabbit.

Jackrabbit keeps a long-lived database connection for each workspace.
That connection is shared among any number of JCR sessions that access
the same workspace, so it is not considered a part of the resources
associated with the JCR session.

For example, if you open N connections to the same workspace, you'll
only see one backend database connection open.

Those workspace database connections will be closed when the entire
repository gets closed.

Note that the ongoing database connection pooling work targeted for
Jackrabbit 2.0 will include a mechanism that will automatically close
those backend connections once they've been unused for a while.

BR,

Jukka Zitting

Re: many sessions remain unclosed

Posted by Radu Ana-Maria <ra...@gmail.com>.
i'm going to do this! 10x a lot

and the code is just a simple example and not what i'm using..  Thanks for
helping !!

ana r.

On Wed, Oct 21, 2009 at 11:30 AM, Stefan Guggisberg <
stefan.guggisberg@gmail.com> wrote:

> On Wed, Oct 21, 2009 at 9:48 AM, Radu Ana-Maria <ra...@gmail.com>
> wrote:
> > hello,
> >
> > I'm working with: jackrabbit 1.5.6 + postgresql 8.4 , and i found a
> little
> > problem in my code with unclosed session even if i do session.logout()
> for
> > each new session.
> >
> > for example:
> >
> > *sessionPPL = repository.login(credentials);
> >  workspaceList = sessionPPL.getWorkspace().getAccessibleWorkspaceNames();
> >
> > for (String x : workspaceList ) {
> >   sessionInUse = repository.login(credentials, x);
> >   // and here i do something else.. like add some nodes etc.
> >  sessionInUse .save();
> > sessionInUse .logout();
> > }
> > sessionPPL .logout();*
> >
> > and when i open the postgreSQL admin i see that i have more then 80
> session
> > opend and not closed by jackrabbit.
>
> you have ~80 (or ~40, dependening on your configuration) workspaces.
> the db sessions you're seeing are per workspace. they're not associated
> with any particular jcr session.
>
> >
> > --  sessionInUse .logout(); must stop the session opend in postgreSQL? or
> > not? if not, how can i stop this sessions from postgreSQL.
>
> you can configure a maxIdleTime per workspace. workspaces idling
> longer than the specified value will be closed automatically and
> resources released,
>
> see
> http://jackrabbit.apache.org/jackrabbit-configuration.html#JackrabbitConfiguration-Workspaceconfiguration
>
> otoh, your code sample looks kind of strange:
>
>  for (String x : workspaceList ) {
>   sessionInUse = repository.login(credentials, x);
>    // ...
>  }
>
> why do you do the same operations on all workspaces.
> you might consider redesigning your content model
> by reducing the number of workspaces.
>
> cheers
> stefan
>
> >
> > the api say:
> > *public void logout() -- Releases all resources associated with this
> > Session. This method should be called when a
> > Session is no longer needed.*
> >
> > Any help would be greatful
> > Thanks,
> > ana r.
> >
>

Re: many sessions remain unclosed

Posted by Stefan Guggisberg <st...@gmail.com>.
On Wed, Oct 21, 2009 at 9:48 AM, Radu Ana-Maria <ra...@gmail.com> wrote:
> hello,
>
> I'm working with: jackrabbit 1.5.6 + postgresql 8.4 , and i found a little
> problem in my code with unclosed session even if i do session.logout() for
> each new session.
>
> for example:
>
> *sessionPPL = repository.login(credentials);
>  workspaceList = sessionPPL.getWorkspace().getAccessibleWorkspaceNames();
>
> for (String x : workspaceList ) {
>   sessionInUse = repository.login(credentials, x);
>   // and here i do something else.. like add some nodes etc.
>  sessionInUse .save();
> sessionInUse .logout();
> }
> sessionPPL .logout();*
>
> and when i open the postgreSQL admin i see that i have more then 80 session
> opend and not closed by jackrabbit.

you have ~80 (or ~40, dependening on your configuration) workspaces.
the db sessions you're seeing are per workspace. they're not associated
with any particular jcr session.

>
> --  sessionInUse .logout(); must stop the session opend in postgreSQL? or
> not? if not, how can i stop this sessions from postgreSQL.

you can configure a maxIdleTime per workspace. workspaces idling
longer than the specified value will be closed automatically and
resources released,

see http://jackrabbit.apache.org/jackrabbit-configuration.html#JackrabbitConfiguration-Workspaceconfiguration

otoh, your code sample looks kind of strange:

 for (String x : workspaceList ) {
   sessionInUse = repository.login(credentials, x);
   // ...
 }

why do you do the same operations on all workspaces.
you might consider redesigning your content model
by reducing the number of workspaces.

cheers
stefan

>
> the api say:
> *public void logout() -- Releases all resources associated with this
> Session. This method should be called when a
> Session is no longer needed.*
>
> Any help would be greatful
> Thanks,
> ana r.
>