You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Michael Anstis <mi...@gmail.com> on 2011/04/12 15:35:04 UTC

Continuous Integration: Rapid Session creation\shutdown - javax.jcr.RepositoryException: xxx appears to be already locked by the current process.

Hi,

We run a lot of JUnit tests during the CI build of our application.

These tests individually involve the following (some of which may or may not
be relevant, but I include here for completeness):-

    * creating a TransientRepository,
    * creating a Session,
    * configuring repository with a few custom node types,
    * running tests,
    * shutting down repository with repository.shutdown()

The tests work fine when ran on a local PC, but when ran on a server we
often encounter random (i.e. not consistent where they fall) errors
"javax.jcr.RepositoryException: The repository home XYZ appears to be
already locked by the current process."

I suspect the .lock file is not being cleared from the FileSystem before the
next test starts to run and hence the lock error is thrown.

Can anybody recommend an approach to ensure the Repository has been
completely shutdown and all FileSystem changes flushed?

I have posted the same question to Stackoverflow; I hope it does not present
any problems.

Thanks,

Mike

Re: Continuous Integration: Rapid Session creation\shutdown - javax.jcr.RepositoryException: xxx appears to be already locked by the current process.

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

we had the same problem in Apache Sling - we now just wait two seconds
on shutdown of the test class. This gives the repository enough time to
shutdown and our problems were solved.

Regards
Carsten

Michael Anstis  wrote
> Hi,
> 
> We run a lot of JUnit tests during the CI build of our application.
> 
> These tests individually involve the following (some of which may or may not
> be relevant, but I include here for completeness):-
> 
>     * creating a TransientRepository,
>     * creating a Session,
>     * configuring repository with a few custom node types,
>     * running tests,
>     * shutting down repository with repository.shutdown()
> 
> The tests work fine when ran on a local PC, but when ran on a server we
> often encounter random (i.e. not consistent where they fall) errors
> "javax.jcr.RepositoryException: The repository home XYZ appears to be
> already locked by the current process."
> 
> I suspect the .lock file is not being cleared from the FileSystem before the
> next test starts to run and hence the lock error is thrown.
> 
> Can anybody recommend an approach to ensure the Repository has been
> completely shutdown and all FileSystem changes flushed?
> 
> I have posted the same question to Stackoverflow; I hope it does not present
> any problems.
> 
> Thanks,
> 
> Mike
> 


-- 
Carsten Ziegeler
cziegeler@apache.org