From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Amit Kapila <akapila@postgresql.org>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add tests for '-f' option in dropdb utility.
Date: Thu, 28 Nov 2019 15:55:21 -0500
Message-ID: <31225.1574974521@sss.pgh.pa.us> (raw)
In-Reply-To: <CAA4eK1KrNAgCVReP2ttSEg4Uj2imJvmUaitXcmU_hn0TkfiZDQ@mail.gmail.com>
References: <E1iaD8h-0004us-K9@gemulon.postgresql.org>
<CAA4eK1KO6Ed1+ijUKw3M-KQc6AJZd-3Wkq7zAQA-7T08qBnrTg@mail.gmail.com>
<CAA4eK1LC1mapqzG9N=cFoEyEPMmaUb72f+-EOeVuK4jnEFRyyw@mail.gmail.com>
<30914.1574952369@sss.pgh.pa.us>
<CAA4eK1KrNAgCVReP2ttSEg4Uj2imJvmUaitXcmU_hn0TkfiZDQ@mail.gmail.com>
Amit Kapila <amit.kapila16@gmail.com> writes:
> On Thu, Nov 28, 2019 at 8:16 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think the correct question to ask is "why not all cases"?
> As of now, it seems to me that this happens only on Windows. I am not
> sure why so? I will investigate this further and share my findings.
A couple of interesting things stand out from looking at the buildfarm
failures:
* On some of the machines, it seems like "chomp" is failing to get
rid of all the trailing whitespace in $pid:
ok 4 - acquired pid for SIGTERM
not ok 5 - database foobar1 is used
# Failed test 'database foobar1 is used'
# at t/051_dropdb_force.pl line 71.
# got: '212024'
# expected: '212024
'
How can that be? It somewhat-accidentally doesn't seem to be
causing any additional problems, but still we need this test
step to work (or else remove it, it's not really essential).
* On all the failing machines, it's very clear from the postmaster
log that the backend knows why it's being terminated:
2019-11-28 13:47:56.320 UTC [212024:4] 051_dropdb_force.pl FATAL: terminating connection due to administrator command
So the question seems to be why libpq isn't reporting that
message before it detects connection-closed.
This triggered a vague memory, and after a bit of archives-digging,
I found this thread from a few months back:
https://www.postgresql.org/message-id/flat/CA%2BhUKGJowQypXSKsjws9A%2BnEQDD0-mExHZqFXtJ09N209rCO5A%4...
in which it's alleged that Windows' TCP stack is flat-out
broken and will drop not-yet-delivered data when the server
closes the connection.
If that's true, it's pretty nasty. Windows is about the
last platform where I'd want us to have behavior like this,
because we *will* get bug reports about it from novices.
If there's no other workaround, I'm tempted to propose
#ifdef WIN32
pg_sleep(1 second);
#endif
or something close to that, before we close the socket.
Or we could revert the whole feature. I'm not sure it's
worth fighting portability wars for.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, amit.kapila16@gmail.com, akapila@postgresql.org, pavel.stehule@gmail.com
Subject: Re: pgsql: Add tests for '-f' option in dropdb utility.
In-Reply-To: <31225.1574974521@sss.pgh.pa.us>
References: <E1iaD8h-0004us-K9@gemulon.postgresql.org> <CAA4eK1KO6Ed1+ijUKw3M-KQc6AJZd-3Wkq7zAQA-7T08qBnrTg@mail.gmail.com> <CAA4eK1LC1mapqzG9N=cFoEyEPMmaUb72f+-EOeVuK4jnEFRyyw@mail.gmail.com> <30914.1574952369@sss.pgh.pa.us> <CAA4eK1KrNAgCVReP2ttSEg4Uj2imJvmUaitXcmU_hn0TkfiZDQ@mail.gmail.com> <31225.1574974521@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