From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com> |
Cc: | psycopg(at)postgresql(dot)org |
Subject: | Re: psycopg2 conn.poll() hangs when used with sshtunnel |
Date: | 2018-10-30 14:26:38 |
Message-ID: | CA+mi_8Yy5OswpaBH_PTegjs5WS_=nr4VJNGenk7tBJW+wA_Qxg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On Tue, Oct 30, 2018 at 1:55 PM Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
wrote:
> Hi
>
> On Tue, 30 Oct 2018, 19:17 Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Akshay Joshi | 2018-10-30 14:50:14 | Re: psycopg2 conn.poll() hangs when used with sshtunnel |
Previous Message | Akshay Joshi | 2018-10-30 13:54:51 | Re: psycopg2 conn.poll() hangs when used with sshtunnel |