Re: Problem with psycopg2 and asyncio

Поиск
Список
Период
Сортировка
От Federico Di Gregorio
Тема Re: Problem with psycopg2 and asyncio
Дата
Msg-id 56D6A7DF.9080907@dndg.it
обсуждение исходный текст
Ответ на Re: Problem with psycopg2 and asyncio  ("Frank Millman" <frank@chagford.com>)
Ответы Re: Problem with psycopg2 and asyncio  ("Frank Millman" <frank@chagford.com>)
Список psycopg
On 02/03/16 09:19, Frank Millman wrote:
> On 02/03/16 09:48, Frank Millman wrote:
>  >
>  > It boils down to the fact that psycopg running in one thread is
> blocking another thread from executing. Running pyodbc and sqlite3 in
> exactly the same conditions do not have this effect. > Therefore my
> (quite possibly wrong) suspicion is that the GIL is not being released
> timeously, or at least psycopg is doing something different from the others.
>  >
> It occurs to me that there is one difference which could be significant.
> As far as I know, pyodbc and sqlite do not use sockets to communicate
> with the database, but psycopg does. Whether that could interfere with
> the socket-handling in the asyncio thread I have no idea, but it is a
> possibility.

I think pyodbc does use sockets.

We try hard to release the GIL anytime we're about to call libpq
functions and, looking at the code, I don't see any obvious place where
the GIL is hold during a time-consuming call.

Can you plase send us your code (the shortest possible version that
actually can be run) so that we can investigate?

Also, I understand your reasons to not use one of the async modes but
you should really look into that because psycopg has very good support
for async loops.

federico

--
Federico Di Gregorio                         federico.digregorio@dndg.it
DNDG srl                                                  http://dndg.it
  Io non sono romantica. La candelina sul tavolo mi vede e si spegne.
                                                       -- sisterconfusion


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

Предыдущее
От: "Frank Millman"
Дата:
Сообщение: Re: Problem with psycopg2 and asyncio
Следующее
От: "Frank Millman"
Дата:
Сообщение: Re: Problem with psycopg2 and asyncio