ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Ruby developers <ruby-core@ruby-lang.org>
Subject: [ruby-core:69897] Re: [Ruby trunk - Bug #11336] TestProcess#test_exec_fd_3_redirect failed on Solaris 10
Date: Wed, 8 Jul 2015 02:55:18 +0000	[thread overview]
Message-ID: <20150708025518.GA13712@dcvr.yhbt.net> (raw)
In-Reply-To: <redmine.journal-53313.20150708004756.f15821152f1feab5@ruby-lang.org>

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)'
> [#<IO:fd 7>, #<IO:fd 8>]
> [#<IO:fd 9>, #<IO:fd 10>]
> [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.

  reply	other threads:[~2015-07-08  2:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11336.20150707093603@ruby-lang.org>
2015-07-07  9:36 ` [ruby-core:69886] [Ruby trunk - Bug #11336] [Open] TestProcess#test_exec_fd_3_redirect failed on Solaris 10 ngotogenome
2015-07-07 16:50   ` [ruby-core:69889] " Eric Wong
2015-07-07 22:21 ` [ruby-core:69893] [Ruby trunk - Bug #11336] " ngotogenome
2015-07-07 22:33   ` [ruby-core:69894] " Eric Wong
2015-07-08  0:47 ` [ruby-core:69895] " ngotogenome
2015-07-08  2:55   ` Eric Wong [this message]
2015-07-08 11:03 ` [ruby-core:69899] " ngotogenome
2015-07-10  9:46 ` [ruby-core:69934] " ngotogenome
2015-07-10  9:52 ` [ruby-core:69935] " ngotogenome
2015-07-16 12:11 ` [ruby-core:70001] [Ruby trunk - Bug #11336] [Open] " ngotogenome
2015-07-16 21:26   ` [ruby-core:70005] " Eric Wong
2015-07-18  3:43     ` [ruby-core:70023] " Eric Wong
2015-07-20  8:13       ` [ruby-core:70050] " Eric Wong
2015-07-17  6:27 ` [ruby-core:70008] [Ruby trunk - Bug #11336] " ngotogenome
2015-07-19 11:27 ` [ruby-core:70041] " ngotogenome
2015-07-20  2:44   ` [ruby-core:70048] " Eric Wong
2015-07-31 13:29 ` [ruby-core:70204] " ngotogenome
2015-07-31 21:02   ` [ruby-core:70206] " Eric Wong
2015-08-14  8:33 ` [ruby-core:70386] [Ruby trunk - Bug #11336] [Open] " ngotogenome
2015-08-14  9:46   ` [ruby-core:70387] " Eric Wong
2015-08-14 15:27 ` [ruby-core:70390] [Ruby trunk - Bug #11336] [Closed] " ngotogenome

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150708025518.GA13712@dcvr.yhbt.net \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).