From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3098046970F for ; Fri, 29 Nov 2019 18:14:14 +0300 (MSK) Received: by mail-lj1-f196.google.com with SMTP id e9so32345608ljp.13 for ; Fri, 29 Nov 2019 07:14:14 -0800 (PST) Date: Fri, 29 Nov 2019 18:14:10 +0300 From: Cyrill Gorcunov Message-ID: <20191129151410.GJ19879@uranus> References: <20191128204512.19732-1-gorcunov@gmail.com> <20191128204512.19732-2-gorcunov@gmail.com> <20191129055939.GH15149@atlas> <20191129094059.GA19879@uranus> <20191129111903.GA7760@atlas> <20191129113659.GE19879@uranus> <20191129145028.GA18043@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191129145028.GA18043@atlas> Subject: Re: [Tarantool-patches] [PATCH 1/5] popen: Introduce a backend engine List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Konstantin Osipov Cc: tml On Fri, Nov 29, 2019 at 05:50:28PM +0300, Konstantin Osipov wrote: > * Cyrill Gorcunov [19/11/29 16:31]: > > And how it is different from fio.write()? I mean I don't understand > > why for regular writes in fio.write() we call for coio and for > > popen we should not do the same. > > Cyrill, the difference is popen works with a pipe, not a file. > Unix supports non-blocking IO for pipes, and usually it doesn't > support it for files. OK, i've got what you mean. Kostya, let me express some more details on current implementation, maybe I simply miss something obvious: 1) The pipes I use are opened in blocking mode, non-blocking read implemented via explicit call to poll() with timeout option (to be honest I'm a bit worried about signal interruption from timers which libev provides, won't they interrupt poll since they all are living in same thread, I need to understand this moment later). IOW, using pipes in blocking mode and poll with timeout for nonblocking read is correct solution or we shoudl use nonbloking ops from the very beginning? 2) When I do various ops on popen object (say sending kill, fetching status of a process and etc) I block SIGCHLD of coio thread, otherwise there is a race with external users which could simply kill the "command" process we're running and popen->pid no longer valid, what is worse someone else could be take this pid already. Thus I need to block signals for this sake, and now if I start calling the popen helpers without entering coio thread (ie without coio_custom helpers) I wont be able to block signals. If I understand correctly the console is running inside own thread, no?