Issue #11336 has been updated by Naohisa Goto.


The following example can reproduce the problem that the timer thread reads fd=3 after the redirection to fd=3 is set and before execve() is called, and then the script waits forever in b[0].read(1) and/or IO.for_fd(3).read(1). 

~~~
ruby -e 'a = IO.pipe; b = IO.pipe; p a; p b; opt = { 3=>a[0], 1=>b[1] }; (5..50).each { |i| opt[i] = "/dev/zero" }; pid = fork { exec("ruby", "-e", "print IO.for_fd(3).read(1)", opt)}; b[1].close; a[0].close; a[1].write("."); p b[0].read(1); Process.wait(pid)'
~~~

So, I also think stopping timer thread before execve is needed on all OS.

----------------------------------------
Bug #11336: TestProcess#test_exec_fd_3_redirect failed on Solaris 10
https://bugs.ruby-lang.org/issues/11336#change-53356

* Author: Naohisa Goto
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-07-06) [sparc64-solaris2.10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
On Solaris 10, TestProcess#test_exec_fd_3_redirect failed since r51146 (where the test was added).

~~~
  1) Failure:
TestProcess#test_exec_fd_3_redirect [/XXXXX-51146/test/ruby/test_process.rb:2049]:
<"."> expected but was
<nil>.
~~~





-- 
https://bugs.ruby-lang.org/