Re: [pysqlite] Concurrency - first steps

"Hugh Gibson" <hgibson-CVW/MsmY5bNaa/[email protected]> Wed, 5 Nov 2008 21:22 +0000 (GMT Standard Time)
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
> Are you trying to use the same Connection object (or cursors from 
> it) across multiple threads?

No, we already create a connection object per thread.
 
> If that is the case then it is not safe.  (pysqlite prevents it by
> default).

Yes, we hit this. I've only recently discovered threading.local giving
local thread storage which has simplified creating per-thread connections
(previously had to create a connection in a global structure,
necessitating a system-wide lock).

> Using your own locking is ok but relying on that builtin 
> to APSW and pysqlite is not.  In the case of APSW you will get 
> deadlocks. In the case of pysqlite you will get core dumps.

Do you mean if we use a common connection object, or are there other
issues? I ran the test in
http://itsystementwicklung.de/pipermail/list-pysqlite/2008-September/00015

1.html without any problems.
 
> I have fixed APSW for the next release but it also requires the next
> version of SQLite to address various problems in SQLite.

Any pointers? 

Hugh