From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Christoph Berg <myon@debian.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: src/test/recovery regression failure on bionic
Date: Wed, 08 Jan 2020 19:18:04 -0500
Message-ID: <2581.1578529084@sss.pgh.pa.us> (raw)
In-Reply-To: <20200108232205.vegvaao4t672iuy5@alap3.anarazel.de>
References: <E1in6ft-0004zR-6l@gemulon.postgresql.org>
<20200103110128.GA28967@msg.df7cb.de>
<13708.1578059577@sss.pgh.pa.us>
<25771.1578249042@sss.pgh.pa.us>
<20200106105608.GB18560@msg.df7cb.de>
<CAA4eK1KtQDU=RTAPi6id6Nvv1HkKrpDp_ZZ_uHL1XQ0cjT2_eg@mail.gmail.com>
<20200108143825.GF27312@msg.df7cb.de>
<5533.1578495857@sss.pgh.pa.us>
<1462.1578522666@sss.pgh.pa.us>
<20200108232205.vegvaao4t672iuy5@alap3.anarazel.de>
Andres Freund <andres@anarazel.de> writes:
> Is it worth having the test close superflous FDs? It'd not be hard to do
> so via brute force (or even going through /proc/self/fd).
No, it isn't, because d20703805's test is broken by design. There
are any number of reasons why there might be more than three-or-so
FDs open during postmaster start. Here are a few:
* It seems pretty likely that at least one of those FDs is
intentionally being left open by cron so it can detect death of
all child processes (like our postmaster death pipe). Forcibly
closing them will not necessarily have nice results. Other
execution environments might do similar tricks.
* On platforms where semaphores eat a FD apiece, we intentionally
open those before counting free FDs.
* We run process_shared_preload_libraries before counting free FDs,
too. If a loaded library intentionally leaves a FD open in the
postmaster, counting that against the limit also seems like a good
idea.
My opinion is still that we should just get rid of that test case.
The odds of it ever finding anything interesting seem too low to
justify the work that will be involved in (a) getting it to work
reliably today and then (b) keeping it working. Running on the
hairy edge of not having enough FDs doesn't seem like a use-case
that we want to spend a lot of time on, but we will be if that
test stays as it is. Example: if max_safe_fds is only 10, as
this test is trying to make it be, then maxAllocatedDescs won't
be allowed to exceed 5. Do you want to bet that no code paths
will reasonably exceed that limit? [1] What will we do about it
when we find one that does?
I also note that the test can only catch cases where we used
OpenTransientFile() in an inappropriate way. I think it's at
least as likely that somebody would carelessly use open()
directly, and then we have no chance of catching it till the
kernel complains about EMFILE.
Thinking about that some more, maybe the appropriate thing
to do is not to mess with max_files_per_process as such,
but to test with some artificial limit on maxAllocatedDescs.
We still won't catch direct use of open(), but that could test
for misuse of OpenTransientFile() with a lot less environment
dependence.
regards, tom lane
[1] Although I notice that the code coverage report shows we
never reach the enlargement step in reserveAllocatedDesc(),
which means that the set of tests we run today don't exercise
any such path. I'm somewhat surprised to see that we *do*
seem to exercise overrunning max_safe_fds, though, since
ReleaseLruFile() is reached. Maybe this test case is
responsible for that?
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, andres@anarazel.de, amit.kapila16@gmail.com, myon@debian.org, pgsql-hackers@postgresql.org
Subject: Re: src/test/recovery regression failure on bionic
In-Reply-To: <2581.1578529084@sss.pgh.pa.us>
References: <E1in6ft-0004zR-6l@gemulon.postgresql.org> <20200103110128.GA28967@msg.df7cb.de> <13708.1578059577@sss.pgh.pa.us> <25771.1578249042@sss.pgh.pa.us> <20200106105608.GB18560@msg.df7cb.de> <CAA4eK1KtQDU=RTAPi6id6Nvv1HkKrpDp_ZZ_uHL1XQ0cjT2_eg@mail.gmail.com> <20200108143825.GF27312@msg.df7cb.de> <5533.1578495857@sss.pgh.pa.us> <1462.1578522666@sss.pgh.pa.us> <20200108232205.vegvaao4t672iuy5@alap3.anarazel.de> <2581.1578529084@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