Re: all python threads hung

Christian Boos <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
dcharno wrote:
> I have a number of threads which collect and queue data.  A separate 
> thread inserts the queued data in to an sqlite database.  Another thread 
> services network requests for statics from the database.
>
> The problem I have is long periods of time where all threads in the app 
> appear to be hung. I've found that the duration of the 'stall' is always 
> a multiple of the pysqlite timeout I've set -- typically 2x or 3x.  My 
> timeout was set to 20seconds, but none of the database transactions are 
> longer than 200ms.
>
> At most, I'd expect my two threads to hang.  I'm not understanding how 
> all the threads in the system could be effected.  Any thoughts would be 
> greatly appreciated.
>   

It's quite easy to get pysqlite threads blocking each other (see #126 
[1] for more about that).
If in addition, one of the blocked thread is also holding a Lock (the 
one protecting concurrent access to your queue?), then any other thread 
trying to acquire that lock will get blocked as well.

Hope this helps,

-- Christian

[1] - http://www.initd.org/tracker/pysqlite/ticket/126
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.