pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Expansion of our checks for connection-loss errors
Date: Fri, 09 Oct 2020 10:17:52 -0400
Message-ID: <2709572.1602253072@sss.pgh.pa.us> (raw)
In-Reply-To: <5f5b7511-10ab-d272-a4b3-6cf9abd551c2@oss.nttdata.com>
References: <2621622.1602184554@sss.pgh.pa.us>
	<5f5b7511-10ab-d272-a4b3-6cf9abd551c2@oss.nttdata.com>

Fujii Masao <masao.fujii@oss.nttdata.com> writes:
> On 2020/10/09 4:15, Tom Lane wrote:
>> -#ifdef ECONNRESET
>> -			case ECONNRESET:
>> +			case ALL_CONNECTION_LOSS_ERRNOS:
>>   				printfPQExpBuffer(&conn->errorMessage,
>>   								  libpq_gettext("server closed the connection unexpectedly\n"
>>   												"\tThis probably means the server terminated abnormally\n"
>>   												"\tbefore or while processing the request.\n"));

> This change causes the same error message to be reported for those five errno.
> That is, we cannot identify which errno is actually reported, from the error
> message. But I just wonder if it's more helpful for the troubleshooting if we,
> for example, append strerror() into the message so that we can easily
> identify errno. Thought?

Hmm, excellent point.  While our code response to all these errors
should be the same, you are right that that doesn't extend to emitting
identical error texts.  For EHOSTUNREACH/ENETDOWN/ENETUNREACH, we
should say something like "connection to server lost", without claiming
that the server crashed.  It is less clear what to do with ECONNABORTED,
but I'm inclined to put it in the network-problem bucket not the
server-crash bucket, despite lorikeet's behavior.  Thoughts?

This also destroys the patch's idea that switch statements should be
able to handle these all alike.  If we group things as "ECONNRESET means
server crash and the others are all network failures", then I'd be
inclined to leave the ECONNRESET cases alone and just introduce
new infrastructure to recognize all the network-failure errnos.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <2709572.1602253072@sss.pgh.pa.us>
Permalink:  ../2709572.1602253072@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2709572.1602253072@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, masao.fujii@oss.nttdata.com
  Subject: Re: Expansion of our checks for connection-loss errors
  In-Reply-To: <2709572.1602253072@sss.pgh.pa.us>
  References: <2621622.1602184554@sss.pgh.pa.us> <5f5b7511-10ab-d272-a4b3-6cf9abd551c2@oss.nttdata.com> <2709572.1602253072@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