Re: Windows: Wrong error message at connection termination - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Windows: Wrong error message at connection termination
Date
Msg-id 2120381.1638473504@sss.pgh.pa.us
Whole thread Raw
In response to Re: Windows: Wrong error message at connection termination  (Alexander Lakhin <exclusion@gmail.com>)
Responses Re: Windows: Wrong error message at connection termination
List pgsql-hackers
Alexander Lakhin <exclusion@gmail.com> writes:
> 29.11.2021 22:16, Tom Lane wrote:
>> After re-reading that thread and re-studying relevant Windows
>> documentation [1][2], I think the main open question is whether
>> we need to issue shutdown() or not, and if so, whether to use
>> SD_BOTH or just SD_SEND.  I'm inclined to prefer not calling
>> shutdown(), because [1] is self-contradictory as to whether it
>> can block, and [2] is pretty explicit that it's not necessary.

> I've tested the close-only patch with pg_sleep() in pqReadData(), and it
> works too.

Thanks for testing!

> So I wonder how to understand "To assure that all data is
> sent and received on a connected socket before it is closed, an
> application should use shutdown to close connection before calling
> closesocket." in [1].

I suppose their documentation has evolved over time.  This sentence
probably predates their explicit acknowledgement in [2] that you don't
have to call shutdown().  Maybe, once upon a time with very old
versions of Winsock, you did have to do so if you wanted graceful close.

I'll push the close-only change in a little bit.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Column Filtering in Logical Replication
Next
From: Tomas Vondra
Date:
Subject: Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path