Re: Reapply graceful socket shutdown on Windows (revert 29992a6a509)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Gregory Burd <greg(at)burd(dot)me>
Subject: Re: Reapply graceful socket shutdown on Windows (revert 29992a6a509)
Date: 2026-12-01 07:26:46
Message-ID: aw52trWZBLO5kexW@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 26, 2026 at 03:10:59PM +0100, Jelte Fennema-Nio wrote:
> The graceful close is important (it's what fixes Greg's failures), but
> it isn't enough to fix the problem I ran into. If the client sends
> anything after the backend is gone, the server's OS (Windows or Linux)
> answers with an RST and Winsock discards the unread FATAL. That's the
> normal case for a FATAL on an idle connection (bug #15598 [2]), and
> Alexander Lakhin hit it in 2023 too [3]. So attached is a
> fix/workaround for that as well: libpq reads any pending network data
> into its own buffer before sending a new query.

That's a new thing.

> Attached v2, which also addresses Jacob's and Michael's concerns:
> 0001: Zsolt's graceful shutdown reapply, unchanged
> 0002: Zsolt's isolation test skip revert, rebased
> 0003: fixup of 0001's comment, addressing Jacob's review
> 0004: libpq on Windows reads pending input before sending a query on an
> idle connection, plus tests
> 0005: POC for a server-side lingering close, which would make these
> lost FATAL errors even more unlikely

Err, 0005, that controls with a GUC for how long a backend should stay
around to flush its information, feels like an unstable knob to me.
Let's assume that we do 0004, why would there be any need for 0005,
then?

Perhaps it would be better for Jacob to comment here. I was under
the impression that there was little need for more than 0003 in terms
of the tests, at least.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-12-01 07:45:46 Re: Row pattern recognition
Previous Message Michael Paquier 2026-12-01 07:19:36 Re: pgstat: Flush some statistics within running transactions, take 2