pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Victor Spirin <v.spirin@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Sometimes the output to the stdout in Windows disappears
Date: Sat, 17 Oct 2020 11:50:57 -0400
Message-ID: <117919.1602949857@sss.pgh.pa.us> (raw)
In-Reply-To: <b32688da-fafc-bbf6-b786-2dd7d0a4d578@gmail.com>
References: <ac976d8c-03df-d6b8-025c-15a2de8d9af1@postgrespro.ru>
	<4124040.1598898684@sss.pgh.pa.us>
	<b92a7e09-9a60-d76b-e226-7e191fdc6f34@postgrespro.ru>
	<855416.1600022228@sss.pgh.pa.us>
	<ee02eaa2-03f7-74ea-bbdf-3196e506bae3@gmail.com>
	<4156857.1602865112@sss.pgh.pa.us>
	<b32688da-fafc-bbf6-b786-2dd7d0a4d578@gmail.com>

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





view thread (16+ messages)  latest in thread

Message-ID: <117919.1602949857@sss.pgh.pa.us>
Permalink:  ../117919.1602949857@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/117919.1602949857@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, v.spirin@postgrespro.ru, pgsql-hackers@lists.postgresql.org
  Subject: Re: Sometimes the output to the stdout in Windows disappears
  In-Reply-To: <117919.1602949857@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox