Sometimes the output to the stdout in Windows disappears

Victor Spirin <v.spirin@postgrespro.ru>

From: Victor Spirin <v.spirin@postgrespro.ru>
To: pgsql-hackers@lists.postgresql.org
Date: 2020-08-31T18:20:28Z
Lists: pgsql-hackers

Attachments

Hi!

Sometimes the output to stdout on Windows on multicore machines does not 
go through after connecting and disconnecting to the server using the 
PQconnectdbParams and PQfinish functions. I tested on 6 cores.

First we appeared this in some pgbench tests.  Then we found that this 
happens on any console program using PQconnectdbParams and PQfinish.

I am attaching a patch and a script for testing.

-- 
Victor Spirin
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company

Commits

  1. In libpq for Windows, call WSAStartup once and WSACleanup not at all.

  2. Update the Winsock API version requested by libpq.