Re: Sometimes the output to the stdout in Windows disappears

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Victor Spirin <v(dot)spirin(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Sometimes the output to the stdout in Windows disappears
Date: 2020-10-17 15:50:57
Message-ID: 117919.1602949857@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexander Lakhin <exclusion(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-10-17 15:54:29 Re: partition routing layering in nodeModifyTable.c
Previous Message Peter Geoghegan 2020-10-17 15:39:35 Re: pgstat_report_activity() and parallel CREATE INDEX (was: Parallel index creation & pg_stat_activity)