Re: psycopg2 hang with multithread frequent queries

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: psycopg2 hang with multithread frequent queries
Дата
Msg-id CA+mi_8a8Ge3B5F-f5ah0y-WCacRB7vyj__k+C6CRRRgFTgDzKg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: psycopg2 hang with multithread frequent queries  ("P. Christeas" <xrg@linux.gr>)
Ответы Re: psycopg2 hang with multithread frequent queries  (David Roid <dataroid@gmail.com>)
Список psycopg
On Tue, Sep 18, 2012 at 12:39 AM, P. Christeas <xrg@linux.gr> wrote:
> On Tuesday 18 September 2012, David Roid wrote:
>> Hi Daniele, Federico,
>>
>> Just want to know, if I keep signal handler but switch from thread to
>> subprocess, i.e. put the signal handler code with database queries into
>> another process, is that safe?
>>
>
> IMHO, doing anything more than setting some "flag" variables and waking up
> regular threads is bad practice for a signal handler..

Yeah, in a process handler you are not even supposed to call malloc.
This on top of the fact that in python interaction between threads and
signals is unpredictable.

If you want more refined synchronization across agents you may take a
look at gevent/eventlet. But without knowing your problem is hard to
guess a solution.

-- Daniele


В списке psycopg по дате отправления:

Предыдущее
От: "P. Christeas"
Дата:
Сообщение: Re: psycopg2 hang with multithread frequent queries
Следующее
От: David Roid
Дата:
Сообщение: Re: psycopg2 hang with multithread frequent queries