From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id A3F0D17D75E3 for ; Wed, 8 Jul 2015 11:28:27 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id B41ACB5D8CE for ; Wed, 8 Jul 2015 11:55:25 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 0BCE397A82B for ; Wed, 8 Jul 2015 11:55:27 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6WqDo9Pyp1vE for ; Wed, 8 Jul 2015 11:55:26 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id DE9CF97A827 for ; Wed, 8 Jul 2015 11:55:26 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 8FF8C95243E for ; Wed, 8 Jul 2015 11:55:25 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id B697F120462; Wed, 8 Jul 2015 11:55:23 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by neon.ruby-lang.org (Postfix) with ESMTP id 3A0381203A8 for ; Wed, 8 Jul 2015 11:55:20 +0900 (JST) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPSA id 0EFA663382A; Wed, 8 Jul 2015 02:55:19 +0000 (UTC) Date: Wed, 8 Jul 2015 02:55:18 +0000 From: Eric Wong To: Ruby developers Message-ID: <20150708025518.GA13712@dcvr.yhbt.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ML-Name: ruby-core X-Mail-Count: 69897 Subject: [ruby-core:69897] Re: [Ruby trunk - Bug #11336] TestProcess#test_exec_fd_3_redirect failed on Solaris 10 X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" ngotogenome@gmail.com wrote: > ~~~ > $ ruby -e 'a = IO.pipe; b = IO.pipe; p a; p b; pid = fork { exec("ruby", "-e", "print IO.for_fd(3).read(1)", 3=>a[0],1=>b[1]) }; b[1].close; a[0].close; a[1].write("."); p b[0].read(1); Process.wait(pid)' > [#, #] > [#, #] > [ASYNC BUG] consume_communication_pipe: read OK, I also hit the problem on a VM, too. The problem is the timer thread is still running when we are performing redirects for exec. Can you try the following to stop the timer thread? ~~~ --- a/process.c +++ b/process.c @@ -2566,7 +2566,7 @@ rb_f_exec(int argc, const VALUE *argv) #if defined(__APPLE__) || defined(__HAIKU__) rb_exec_without_timer_thread(eargp, errmsg, sizeof(errmsg)); #else - before_exec_async_signal_safe(); /* async-signal-safe */ + before_exec(); /* NOT async-signal-safe */ rb_exec_async_signal_safe(eargp, errmsg, sizeof(errmsg)); preserving_errno(after_exec_async_signal_safe()); /* async-signal-safe */ #endif ~~~ I will have limited Internet access the next few days. Feel free to commit if it works for you; maybe the timer thread needs to be restarted if execve fails, too (but the process will die). Also, maybe the __APPLE__ || __HAIKU__ code above is suitable for all OS, too. In the coming weeks, we may also consider lazy spawning timer thread, single-threaded scripts do not need it.