In my application I have different threads that access documents of Tamino. Different threads can access the same document and to mantain consistency each thread uses transactions to prevent othre threads to access the same document at the same time.
The problem is that I get deadlocks when they are not supposed to happen. I have been able to reproduce the problem in a very simplified scenario:
Each thread creates a new InoConnection and opens a transaction:
conn.BeginTransaction(InoIsolationLevel.StableDocument, InoLockMode.Protected, InoLockwait.Yes);
Then all threads read the same document (with a simple xquery: input()/Doc[@Id=1]). Only one gets the lock. All the others get blocked till the one with the lock closes the transaction.
Then when the one that get not blocked tries to read the same document again, it gets blocked. Deadlock?. I think this is not supposed to happen. It already gained access to the document.
If I just run two threads all goes fine: one thread gains access to the document, the other one waits, the first one can read the document again without blocking and when it closes the transaction the other thread continues.
But with three threads is when the problem occurs.
Why does the thread that already has access to a document get blocked when reading the document again? Am I doing something wrong or it is a bug of Tamino?
The problem occurs both in Tamino 18.104.22.168 under Win2000 Server and Tamino 22.214.171.124 under WinXP.