Project

General

Profile

Actions

Backport #7826

closed

test_setsid rarely fails with Errno::ESRCH at Process.getsid(io.pid)

Added by nagachika (Tomoyuki Chikanaga) about 11 years ago. Updated about 11 years ago.


Description

I've just encountered the following fault in make test-all.

[ 8077/13116] TestProcess#test_setsid = 0.06 s
2) Error:
test_setsid(TestProcess):
Errno::ESRCH: No such process
/Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_process.rb:1592:in getsid' /Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_process.rb:1592:in block in test_setsid'
/Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_process.rb:1581:in popen' /Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_process.rb:1581:in test_setsid'

I think child process could terminate before calling Process.getsid for its pid.
how about the following patch? Process.kill in in ensure-clause guarantee the child process will be terminated.

diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 96335c2..3a69580 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1583,6 +1583,7 @@ class TestProcess < Test::Unit::TestCase
newsid = Process.setsid
Marshal.dump(newsid, STDOUT)
STDOUT.flush

  • sleep
    EOS
    begin
    # test Process.getsid() w/o arg
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0