pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: libpq async duplicate error results
Date: Fri, 06 May 2022 10:28:53 -0400
Message-ID: <2889550.1651847333@sss.pgh.pa.us> (raw)
In-Reply-To: <de57761c-b99b-3435-b0a6-474c72b1149a@enterprisedb.com>
References: <202202081500.xl3iwa7doscz@alvherre.pgsql>
	<394797.1645388816@sss.pgh.pa.us>
	<1262938.1645658107@sss.pgh.pa.us>
	<1421785.1645723238@sss.pgh.pa.us>
	<de57761c-b99b-3435-b0a6-474c72b1149a@enterprisedb.com>

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> I took another look at this.  The output from the test program at the 
> beginning of the thread is now (master branch):
> ...
> command = SELECT 'after';
> PQsendQuery() error: FATAL:  terminating connection due to administrator 
> command
> server closed the connection unexpectedly
> 	This probably means the server terminated abnormally
> 	before or while processing the request.
> no connection to the server

> It appears the "after" query is getting the error message from the 
> previous cycle somehow.

What is happening is that this bit in PQsendQueryStart is deciding
not to clear the message buffer because conn->cmd_queue_head isn't
NULL:

    /*
     * If this is the beginning of a query cycle, reset the error state.
     * However, in pipeline mode with something already queued, the error
     * buffer belongs to that command and we shouldn't clear it.
     */
    if (newQuery && conn->cmd_queue_head == NULL)
        pqClearConnErrorState(conn);

So apparently the fault is with the pipelined-query logic.  I'm
not sure what cleanup step is missing though.

			regards, tom lane





view thread (19+ messages)  latest in thread

Message-ID: <2889550.1651847333@sss.pgh.pa.us>
Permalink:  ../2889550.1651847333@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2889550.1651847333@sss.pgh.pa.us

 · 

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: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com, alvherre@alvh.no-ip.org, coelho@cri.ensmp.fr
  Subject: Re: libpq async duplicate error results
  In-Reply-To: <2889550.1651847333@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox