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
- Status changed from Assigned to Closed
Sorry, my fault.
but I think it was already fixed at r39179. (thx narse-san)
- Status changed from Closed to Open
- ruby -v changed from ruby 2.0.0dev (2012-12-30 trunk 38661) [x86_64-darwin10.8.0] to ruby 2.0.0dev (2013-02-11 trunk 39204) [x86_64-darwin10.8.0]
Sorry, I entered wrong ruby -v
string. I encountered the fault with r39204.
So it may be another issue solved with r39179.
- Status changed from Open to Assigned
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r39245.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- test/ruby/test_process.rb (test_setsid): Added a workaround for
MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]
Thanks nagachika-san.
I realized MacOS X's getsid() wrongly return ESRCH when target process is zombie. I fully agree your patch is good workaround and I committed it.
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport200
- Category deleted (
test)
- Status changed from Closed to Assigned
- Assignee changed from kosaki (Motohiro KOSAKI) to nagachika (Tomoyuki Chikanaga)
r39179 and r39245 should be backported to 2.0.0.
- Status changed from Assigned to Closed
This issue was solved with changeset r39513.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 39179,39245: [Backport #7826]
the process maybe already finished
* test/ruby/test_process.rb (test_setsid): Added a workaround for
MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0