wiki:ProblemsWithJunitTests

The LuceneSail and SesameJenaAdapter something create cases where your junit tests will not terminate. The usual cause of this is a deadlocking problem with the sesame repositories. Some tips for diagnosing and fixing this:

Diagnose:

  • To check if this is indeed the case, you can "debug" the stopping junit test ...
  • ... then pause the main thread. If it's waiting in Object.wait() and the MultiReadSingleWriteLockManager:getWriteLock is just above it in the stack trace, you know your problem.
  • The problem often happens when some code that uses an iterator throws an error, JUnit catches this, but will call the tearDown method first - and there it hangs.

Fixing:

  • In gnowsis-server there is a jar called DEBUG-openrdf-utils.jar - change your project to use this jar instead of the normal one.
  • Make sure you also check the export box for this jar in the ordering/exports tab of gnowsis-server
  • this jar adds a _locks vector to MultiRead..Manager, which keeps track of all unreleased locks, and each lock object has a stacktrace object that stores the stacktrace from when the lock was created.

All in all though - these problems suck, and debugging them sucks even more.

Last modified 18 years ago Last modified on 07/05/06 11:42:19