Re: [Zope] Zope Freezing up with multiple threads accessing objects.
Etienne Labuschagne wrote at 2003-7-14 13:29 +0200:
Ok, I have narrowed down my problem to the following, when calling get_transaction().commit(), the : ... in ZODB.BaseStorage.BaseStorage
tpc_finish line 155: if transaction is not self._transaction: return
It appears as if the same connection were used in two different threads. Do not do that...
Dieter
Hi Dieter, That was my initial though too (since that was how I was originally introduced to opening my own connections!). I'm quite sure it's not that as a typical debug run would go like this: Thread 703 - Start of Commit Thread 703 - Acquire DB Lock Thread 703 - Release DB Lock Thread 703 - Acquire DB Lock Thread 703 - End of Commit The above is abbreviated, but I can send you a more verbose list with stack traces for each step. I printed out the threading.currentThread().getName()s every step to check which threads are doing what. Coming to think of it, the above probably only proves that the commit happens in one thread, not that the objects that are committed weren't changed by multiple threads. Anyway, I will go through my code with a fine comb again as me being sure I don't use a connector from different threads does not mean it isn't so! At the least I will try and give more information trying to prove it isn't so :) Thanks anyway. Etienne
Etienne Labuschagne wrote at 2003-7-16 00:48 +0200:
... The above is abbreviated, but I can send you a more verbose list with stack traces for each step. I printed out the threading.currentThread().getName()s every step to check which threads are doing what.
I am not really interested in a detailed log :-) "Storage._transaction" is set in "tpc_begin" and reset in "tpc_abort" and "tpc_finish". When the check "transaction is self._transaction" fails, look at "self._transaction". When is is None, then someone (maybe a different thread) called "tpc_abort" or "tpc_finish" or (not likely "tpc_begin" was not executed). When it is not None, then its value specifies the transaction that most recently executed "tpc_begin". This must be a different thread (since there is one transaction per thread and "transaction" is ours). Dieter
At 09:21 PM 16/7/2003 +0200, you wrote:
Etienne Labuschagne wrote at 2003-7-16 00:48 +0200:
... The above is abbreviated, but I can send you a more verbose list with stack traces for each step. I printed out the threading.currentThread().getName()s every step to check which threads are doing what.
I am not really interested in a detailed log :-)
"Storage._transaction" is set in "tpc_begin" and reset in "tpc_abort" and "tpc_finish".
When the check "transaction is self._transaction" fails, look at "self._transaction". When is is None, then someone (maybe a different thread) called "tpc_abort" or "tpc_finish" or (not likely "tpc_begin" was not executed). When it is not None, then its value specifies the transaction that most recently executed "tpc_begin". This must be a different thread (since there is one transaction per thread and "transaction" is ours).
Dieter
Ok, I'll save you from the detailed log spam :) Thanks for the info, I'm sure it will help - my case is where self._stransaction is None so I will have a look at what my threads are up to! Etienne
participants (2)
-
Dieter Maurer -
Etienne Labuschagne