Re: Sometimes the output to the stdout in Windows disappears
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Victor Spirin <v.spirin@postgrespro.ru>,
pgsql-hackers@lists.postgresql.org
Date: 2020-10-17T15:50:57Z
Lists: pgsql-hackers
Alexander Lakhin <exclusion@gmail.com> writes: > 16.10.2020 19:18, Tom Lane wrote: >> 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. > What bothers me is: > There must be a call to *WSACleanup* for each successful call to > WSAStartup > <https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsastartup>. Yeah, that is a very odd statement. Surely, the Windows kernel manages to cope if a program crashes without having done that. So what exactly is the downside of intentionally not doing it? There's no reason to care if the Winsock DLL stays loaded until program exit rather than getting unloaded a bit earlier. (If anything, the current code causes an unload/reload cycle for each connection when the application makes a series of PG connections; who could think that's a great idea?) regards, tom lane
Commits
-
In libpq for Windows, call WSAStartup once and WSACleanup not at all.
- cdc7ace161d3 9.6.20 landed
- 883226441d67 11.10 landed
- 6acc31a201d8 9.5.24 landed
- 6670e91078b3 10.15 landed
- d2074daebe16 13.1 landed
- 407580aabb83 12.5 landed
- 7d00a6b2de8a 14.0 landed
-
Update the Winsock API version requested by libpq.
- d5a9a661fcd2 14.0 landed