public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniele Varrazzo <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: [email protected]
Subject: Re: psycopg2 conn.poll() hangs when used with sshtunnel
Date: Tue, 30 Oct 2018 14:26:38 +0000
Message-ID: <CA+mi_8Yy5OswpaBH_PTegjs5WS_=nr4VJNGenk7tBJW+wA_Qxg@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDfDw=9oAePwZk0Su9PLB3ni_NQdJ5Lj1k21GzYe07sY8Q@mail.gmail.com>
References: <CANxoLDc4AosChXUhArLh2ufdon1BRwhCNRgGjyeCsYf9vHTmTw@mail.gmail.com>
<CANxoLDf3ra5UaqFw_6A824_hAi5XPykySr+DJre2ZbprbxTCVA@mail.gmail.com>
<CANxoLDesBkV9=qpg22-9nG=JYgvUuo3Xm+iDxSWwLVReTiEC7g@mail.gmail.com>
<CA+mi_8ZBYkPm7Kou8smEnDfXPPjVByw7o3M-nY3PvVEK_TN9nA@mail.gmail.com>
<CA+mi_8boc=n4jZnX+20-UYwZYd4wse+wrnZWf6zG-1nMhDLmnA@mail.gmail.com>
<CANxoLDfDw=9oAePwZk0Su9PLB3ni_NQdJ5Lj1k21GzYe07sY8Q@mail.gmail.com>
On Tue, Oct 30, 2018 at 1:55 PM Akshay Joshi <[email protected]>
wrote:
> Hi
>
> On Tue, 30 Oct 2018, 19:17 Daniele Varrazzo <[email protected]
> wrote:
>
>> It seems to me that the problem is in pqpath.c pq_get_last_result()
>> function. The loop assumes PQgetResult won't block, which seems always the
>> case with the direct connection, but PQisBusy() actually returns 1
>> connecting through the tunnel.
>>
>> So at a first read, the simplification given by pq_get_last_result() is
>> broken: the results should be returned one by one in the normal loop going
>> through PQisBusy(), PQconsumeInput(), and the polling machinery. It seems a
>> chunky refactoring but as it is now I don't like pq_get_last_result()
>> anymore :(
>>
>
> What changes should I made to fix this? Or it should be fixed in
> psycopg2 itself.
>
It is a problem in psycopg. I have a quick fix I can release with the next
bugfix if it shows no regression (
https://github.com/psycopg/psycopg2/issues/801). A better fix requires a
non trivial rewrite of the async and green paths (
https://github.com/psycopg/psycopg2/issues/802): I'd like to do it but it
may happen later if the band aid holds.
I was just about to prepare the 2.7.6 release, so if the quick fix is easy
and doesn't cause regressions it will be released soon.
-- Daniele
view thread (11+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: psycopg2 conn.poll() hangs when used with sshtunnel
In-Reply-To: <CA+mi_8Yy5OswpaBH_PTegjs5WS_=nr4VJNGenk7tBJW+wA_Qxg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox