pgsql: Treat ETIMEDOUT as indicating a non-recoverable connection failu

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Treat ETIMEDOUT as indicating a non-recoverable connection failu
Date: 2021-09-30 18:16:18
Message-ID: E1mW0bS-0007nR-Fw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Treat ETIMEDOUT as indicating a non-recoverable connection failure.

Add ETIMEDOUT to ALL_CONNECTION_FAILURE_ERRNOS' list of "errnos that
identify hard failure of a previously-established network connection".
While one could imagine that this is sometimes recoverable, the same
could be said of other entries such as ENETDOWN.

In support of this, handle ETIMEDOUT on par with other socket errors
in relevant infrastructure, such as TranslateSocketError().
(I made a couple of cosmetic adjustments in TranslateSocketError(),
too.) The code now assumes that ETIMEDOUT is defined everywhere,
which it should be given that POSIX has required it since SUSv2.

Perhaps this should be back-patched, but I'm hesitant to do so given
the lack of previous complaints, and the hazard that there's a small
ABI break on Windows from redefining the symbol. Even if we decide
to do that, it'd be prudent to let this bake awhile in HEAD first.

Jelte Fennema

Discussion: https://postgr.es/m/AM5PR83MB01782BFF2978505F6D6C559AF7AA9@AM5PR83MB0178.EURPRD83.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b484ddf4d2eb81736512efa35ed3e5d2a72993d8

Modified Files
--------------
src/backend/port/win32/socket.c | 11 ++++++++---
src/include/port.h | 3 ++-
src/include/port/win32_port.h | 2 ++
src/port/strerror.c | 2 --
4 files changed, 12 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2021-09-30 19:02:04 Re: pgsql: Document XLOG_INCLUDE_XID a little better
Previous Message Alvaro Herrera 2021-09-30 13:07:51 Re: pgsql: Fix WAL replay in presence of an incomplete record