Re: Sometimes the output to the stdout in Windows disappears - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Sometimes the output to the stdout in Windows disappears
Date
Msg-id bc946352-a7e8-bf81-9069-8bc9c912f674@dunslane.net
Whole thread Raw
In response to Re: Sometimes the output to the stdout in Windows disappears  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 10/16/20 12:18 PM, Tom Lane wrote:
>
> But wait a minute: I just looked at Microsoft's docs [1] and found
>
>     In a multithreaded environment, WSACleanup terminates Windows Sockets
>     operations for all threads.
>
> This makes me (a) wonder if that explains the side-effects on stdio,
> and (b) question why libpq is calling WSACleanup at all.
> What if we arranged to call WSAStartup just once, during the first
> libpq connection-open in a process, and then never did WSACleanup?
> Surely the OS can cope with that, and it eliminates any risk that
> WSACleanup breaks something.
>
>             regards, tom lane
>
> [1] https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsacleanup
>
>


This could explain random transient stdout/stderr failures we have seen
over the years. I think we should at least give your suggestion a try -
this is a good time in the dev cycle for such experiments.


cheers


andrew






pgsql-hackers by date:

Previous
From: "Daniel Westermann (DWE)"
Date:
Subject: Re: Wrong example in the bloom documentation
Next
From: "David G. Johnston"
Date:
Subject: Re: [PATCH] Add extra statistics to explain for Nested Loop