Project

General

Profile

Backport #7826

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

Added by nagachika (Tomoyuki Chikanaga) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:52126]

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

Also available in: Atom PDF