Re: MSVC SSL test failure
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Alexander Lakhin <exclusion@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Lars Kanis <lars@greiz-reinsdorf.de>
Date: 2021-12-06T20:51:16Z
Lists: pgsql-hackers
On 12/6/21 10:30, Alexander Lakhin wrote: > Hello Andrew, > 06.12.2021 17:56, Andrew Dunstan wrote: >> Yeah, quite annoying, especially because only some combinations of MSVC >> runtime / openssl version seem to trigger the problem. >> >> >> Adding a shutdown() before the closesocket() also fixes the issue. >> > Can you confirm that adding shutdown(MyProcPort->sock, SD_BOTH) fixes > the issue for many test runs? > I don't see the stable test passing here. > Without shutdown() the test failed on iterations 1, 5, 4, but with > shutdown() it failed too, on iterations 3, 1, 4. > Without close() and shutdown() the test passes 20 iterations. > (I'm still researching how openssl affects the shutdown sequence.) I have been getting 100% failures on the SSL tests with closesocket() alone, and 100% success over 10 tests with this: diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 96ab37c7d0..5998c089b0 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -295,6 +295,7 @@ socket_close(int code, Datum arg) * Windows too. But it's a lot more fragile than the other way. */ #ifdef WIN32 + shutdown(MyProcPort->sock, SD_SEND); closesocket(MyProcPort->sock); #endif That said, your results are quite worrying. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com
Commits
-
On Windows, also call shutdown() while closing the client socket.
- 878f38b80e91 10.20 landed
- 23bc57d564b2 11.15 landed
- a9e572c6d576 12.10 landed
- a8a983e8299a 13.6 landed
- ea5ecdadf6ea 14.2 landed
- ed52c3707bcf 15.0 landed
-
On Windows, close the client socket explicitly during backend shutdown.
- 6051857fc953 15.0 cited