public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andres Freund <[email protected]>
To: [email protected]
Subject: libpq maligning postgres stability
Date: Thu, 27 Mar 2025 11:19:16 -0400
Message-ID: <up7whuxn263agr7whdzzoak7mo7ywryc7z7z3ejdvgbbke4vji@3puckkgm4ide> (raw)
Hi,
We have several places in libpq where libpq says that a connection closing is
probably due to a server crash with a message like:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing
I think this is rather unhelpful, at least these days. There are a lot of
reasons the connection could have failed, the server having terminated
abnormally is just one of them.
It's common to see this due to network issues, for example. I've quite a few
times fielded worried questions of postgres users due to the message.
The reason I was looking at this message just now was a discussion of CI
failures on windows [1], which were likely caused by the known issue of
windows occasionally swallowing the server's last messages before the backend
exits (more detail e.g. in [2]). It's easy to think that the failure was
wrongly caused by a postgres crash, due to the message, rather than due to not
receiving the expected FATAL.
And we don't even just add this message when the connection was actually
closed unexpectedly, we often do it even when we *did* get a FATAL, as in this
example:
psql -c 'select pg_terminate_backend(pg_backend_pid())'
FATAL: 57P01: terminating connection due to administrator command
LOCATION: ProcessInterrupts, postgres.c:3351
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
connection to server was lost
I think this one is mostly a weakness in how libpq tracks connection state,
but it kind of shows the silliness of claiming postgres probably crashed.
Greetings,
Andres Freund
[1] Via Bilal:
4 of the failures on the front page are related to Windows:
https://cirrus-ci.com/build/4878370632105984
https://cirrus-ci.com/build/5063665856020480
https://cirrus-ci.com/build/4636858312818688
https://cirrus-ci.com/build/6385762419081216
[2] https://postgr.es/m/CA%2BhUKGLR10ZqRCvdoRrkQusq75wF5%3DvEetRSs2_u1s%2BFAUosFQ%40mail.gmail.com
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: [email protected]
Cc: [email protected]
Subject: Re: libpq maligning postgres stability
In-Reply-To: <up7whuxn263agr7whdzzoak7mo7ywryc7z7z3ejdvgbbke4vji@3puckkgm4ide>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox