Thanks Daniele On Tue, 30 Oct 2018, 19:56 Daniele Varrazzo <daniele.varra...@gmail.com wrote:
> On Tue, Oct 30, 2018 at 1:55 PM Akshay Joshi < > akshay.jo...@enterprisedb.com> wrote: > >> Hi >> >> On Tue, 30 Oct 2018, 19:17 Daniele Varrazzo <daniele.varra...@gmail.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 > >