Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gMAba-0003G9-O2 for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Nov 2018 11:42:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gMAbX-0001zX-Fz for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Nov 2018 11:42:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gMAbX-0001zL-8m; Mon, 12 Nov 2018 11:42:07 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gMAbU-0002s2-1y; Mon, 12 Nov 2018 11:42:06 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id wACBg0HJ021910; Mon, 12 Nov 2018 20:42:00 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 18CBEEA7C7A; Mon, 12 Nov 2018 20:42:00 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 0E338EA7C78; Mon, 12 Nov 2018 20:42:00 +0900 (JST) Received: from [IPv6:::1] (unknown [129.60.241.75]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 06FB340066A; Mon, 12 Nov 2018 20:42:00 +0900 (JST) Message-ID: <5BE966F4.1040702@lab.ntt.co.jp> Date: Mon, 12 Nov 2018 20:41:40 +0900 From: Etsuro Fujita User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Subject: Re: BUG #15449: file_fdw using program cause exit code error when using LIMIT References: <5BE4318F.4040002@lab.ntt.co.jp> <20181109.143931.243136889.horiguchi.kyotaro@lab.ntt.co.jp> <5BE552ED.4040304@lab.ntt.co.jp> <20181112.185214.76711162.horiguchi.kyotaro@lab.ntt.co.jp> In-Reply-To: <20181112.185214.76711162.horiguchi.kyotaro@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Kyotaro HORIGUCHI Cc: thomas.munro@enterprisedb.com, tgl@sss.pgh.pa.us, eric.cyr@gmail.com, pgsql-bugs@lists.postgresql.org, pgsql-hackers@lists.postgresql.org X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk (2018/11/12 18:52), Kyotaro HORIGUCHI wrote: > At Fri, 09 Nov 2018 18:27:09 +0900, Etsuro Fujita wrote in<5BE552ED.4040304@lab.ntt.co.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. OK > 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. Thanks! Best regards, Etsuro Fujita [1] https://www.postgresql.org/message-id/CAEepm%3D0fBPiRkSiJ3v4ynm%2BaP-A-dhuHjTFBAxwo59EkE2-E5Q%40mail.gmail.com