Re: psycopg2 hang with multithread frequent queries - Mailing list psycopg

From David Roid
Subject Re: psycopg2 hang with multithread frequent queries
Date
Msg-id CAKN1bq4hJQXykyoQjFe2Ee3H9_CdVJ-1g6pXA7-qRc4yhwPJkA@mail.gmail.com
Whole thread Raw
In response to psycopg2 hang with multithread frequent queries  (David Roid <dataroid@gmail.com>)
Responses Re: psycopg2 hang with multithread frequent queries
Re: psycopg2 hang with multithread frequent queries
List psycopg
Sorry I didn't finish it..

And there are two kind of symptons after the process running for a couple of minutes:
(0. At first it seems ok, each thread does its job, the quick one with more logs of course)
1. The quick one keeps running, the other two get no chance being called any more
2. When one of the slow ones get called, the whole python process hang, with the postgresql process in 'idle in transaction'; note i'm very alert with psycopg2's all-in-transaction style, i'm very sure there is a commit/rollback to end the trac, the python process just stucks!

I'm doing this test/investigate with freeload, so CPU/code conditions should not be a cause, i'm starting to suspect psycopg2 or postgresql, any hint?

Thanks and Regards
-David

2012/9/15 David Roid <dataroid@gmail.com>
Greetings list,

I'm using psycopg2, python2.7.3 threading along with pgsql 9.1.5. I noticed that if I have my python process query against the database kind of frequently, say more than 1 query per second, it's almost 100% sure to hit some problem, but first some backgroud:

1. There are three threads, each with many SELECT/UPDATE, a little bit INSERT, only one explicit 'LOCK TABLE'
2. One of threads queries the db every second (easier to reproduce this way)
3. The other two do their queries like every 10~30 seconds
4. It doesn't matter whether the threads share one connection or with separate connection,

And there are two kind of  symptons:
1.

psycopg by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Re: psycopg2 hang with multithread frequent queries
Next
From: David Roid
Date:
Subject: Re: psycopg2 hang with multithread frequent queries