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