From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16678: The ecpg connect/test5 test sometimes fails on Windows
Date: Sat, 24 Oct 2020 13:39:05 -0400
Message-ID: <383222.1603561145@sss.pgh.pa.us> (raw)
In-Reply-To: <f558fb39-ce9e-a516-d7c3-fc94fb581711@gmail.com>
References: <16678-253e48d34dc0c376@postgresql.org>
<434311.1603135136@sss.pgh.pa.us>
<f558fb39-ce9e-a516-d7c3-fc94fb581711@gmail.com>
Alexander Lakhin <exclusion@gmail.com> writes:
> So I've also tested on Windows the following version:
> secure_close(MyProcPort);
> shutdown(MyProcPort->sock, SD_SEND);
> for(;;) {
> char buffer[1000];
> int res = recv(MyProcPort->sock, buffer, 1000, 0);
> if (res <= 0)
> break;
> }
> closesocket(MyProcPort->sock);
> And it works too.
I'm afraid this cure is probably worse than the disease, because
now the backend's exiting is held hostage by whether the client
closes its socket (and the resulting FIN reaches us, which it
might not if there's a network problem).
It might be safe to do the shutdown() only, since Microsoft
specifies that that doesn't block, but I have no idea if that
would improve matters.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16678: The ecpg connect/test5 test sometimes fails on Windows
In-Reply-To: <383222.1603561145@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