Re: psycopg2 hang with multithread frequent queries

From: David Roid <dataroid(at)gmail(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Re: psycopg2 hang with multithread frequent queries
Date: 2012-09-14 16:55:51
Message-ID: CAKN1bq4hJQXykyoQjFe2Ee3H9_CdVJ-1g6pXA7-qRc4yhwPJkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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.
>

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message David Roid 2012-09-14 17:00:26 Re: psycopg2 hang with multithread frequent queries
Previous Message Daniele Varrazzo 2012-09-14 16:53:12 Re: psycopg2 hang with multithread frequent queries