Re: BUG #15449: file_fdw using program cause exit code error when using LIMIT

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: thomas(dot)munro(at)enterprisedb(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, eric(dot)cyr(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15449: file_fdw using program cause exit code error when using LIMIT
Date: 2018-11-12 11:41:40
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

(2018/11/12 18:52), Kyotaro HORIGUCHI wrote:
> At Fri, 09 Nov 2018 18:27:09 +0900, Etsuro Fujita<fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote in<5BE552ED(dot)4040304(at)lab(dot)ntt(dot)co(dot)jp>
>>> Ok, I can live with that with no problem.
>> OK
> ...
>>> I think Thomas just saying that reading more lines can develop
>>> problems. According to the current discussion, we should error
>>> out if we had SEGV when limit 1.
>> Ah, I misread that. Sorry for the noise.
> Being said that, the ruby case may suggest that we should be more
> tolerant for the crash-after-limit case.

The Ruby case would be sad, but I'm not sure we can handle such a case
safely in general, because core and file_fdw don't have enough knowledge
about whether a non-zero exit code returned from pclose is OK or not,
which would actually depend on the called program. One approach for
that would be to add an option to file_fdw for the called program to
tell it to ignore those exit codes, which would be somewhat similar to
what Thomas proposed [1].

>>> In my understanding processes not connected to a
>>> terminal(tty/pts) cannot receive TTIN/TTOU (unless someone sent
>>> it artifically). Since child processes are detached by setsid()
>>> (on Linux), programs called in that way also won't have a
>>> controlling terminal at the start time and I suppose they have no
>>> means to connect to one since they are no longer on the same
>>> session with postmaster.
>> For TTIN and TTOU, we would first need to make clear the reason for
>> the inconsistency Thomas pointed out. I'm wondering if we should
>> leave the TTIN/TTOU stuff for future work.
> Inconsistency?

By "the inconsistency" I mean his words:

Why do bgwriter.c, startup.c, ... set SIGTTIN and SIGTTOU back to
SIG_DFL, but not regular backends?

> I read the Thomas's messages as "TTIO/TTOU are not
> needed to our busines and we don't have a reason to restore them
> before calling external programs other than just plaster
> seemingly consistency." And I agree to the analysis and I agree
> to you on the point that it doens't need consideration just now.


> If the consistency means the different behaviors between perl and
> ruby, (as written in another message,) I'm inclined to vote for
> having a bit more tolerance for error of external programs as my
> second patch.

Maybe my explanation was not enough, but I don't mean that.


Best regards,
Etsuro Fujita


In response to


Browse pgsql-bugs by date

  From Date Subject
Next Message Jürgen Strobel 2018-11-12 13:52:11 Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
Previous Message Mengcheng.Zhong,Tony 2018-11-12 11:15:37 Report a bug about timestamp data type

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Kuzmenkov 2018-11-12 12:05:28 Re: Uninterruptible long planning of a query with too many WHERE clauses
Previous Message Kyotaro HORIGUCHI 2018-11-12 11:10:42 Re: shared-memory based stats collector