Re: Multi-threaded Remote Calls vs. Python imterpreter Lock
"James Henstridge" <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On 16/03/2008, Jozsef Szalay <jszalay-7JS02rSrduhWk0Htik3J/[email protected]> wrote: > Please ignore my previous email! Apparently I was wrong. (Not the first > time :-)) My third thread eventually got blocked regardless of what > cursor factory was used. Also, the cursors were serialized as James > suggested. They need to be synchronised if they are associated with the same transaction. Imagine executing the following two statements in the cursors: INSERT INTO sometable VALUES (...) SELECT * from sometable The result of the SELECT query is going to depend on the first query: you can't execute them in parallel. If you really want to do work in parallel, you'll need multiple connections which also means multiple transactions. > So the issue again is why the python interpreter lock is not released > when a second thread attempts a psycopg call on a connection that is > already busy? Did you try any of the things from my previous email? I'll try and look into it when I have time, but it would be helpful if you could provide a simple test program that exhibits the problem. James.