Problems (bug?) with transactions from multiple threads

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.Open(InoConnectionMode.LocalTransaction);
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 4.2.1.5 under Win2000 Server and Tamino 4.2.1.7 under WinXP.

Thanks

I’ll need to investigate this further. Is it possible you could raise this as a support issue?

My suspicion would be that the problem would be at the .NET end. It could be the actual code, the API or the communications.

I doubt the Tamino server is the problem.

Ok, I will.

Thanks

I tried to reproduce this problem using the enclosed test code.

As far as I could see the code worked with libs shipped in Tamino 4.2.1.
AccessTest.cs (3.02 KB)

I attach the code that reproduces the problem.

And I already get the solution from Tamino support. The next line has to be added:
System.Net.ServicePointManager.DefaultConnectionLimit=10

With this line it works (unless you launch more than 10 threads…)

Thanks,
Marc
Class1.cs (2.33 KB)

I suspect that the reason the problem didn’t manifest itself in my environment was related to the database URL.

I think that the problem may only show up when the URL is for a remote host as opposed to a localhost.