Project

General

Profile

Backport #7826

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

Added by nagachika (Tomoyuki Chikanaga) almost 7 years ago. Updated almost 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

Associated revisions

Revision e4b77588
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 39245
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

Revision 39245
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

Revision 39245
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

Revision 39245
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

Revision 39245
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

Revision 39245
Added by kosaki (Motohiro KOSAKI) almost 7 years ago

  • test/ruby/test_process.rb (test_setsid): Added a workaround for MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]

Revision 77f603cb
Added by nagachika (Tomoyuki Chikanaga) almost 7 years ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 39513
Added by nagachika (Tomoyuki Chikanaga) almost 7 years ago

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]

History

Updated by kosaki (Motohiro KOSAKI) almost 7 years ago

  • Status changed from Assigned to Closed

Sorry, my fault.
but I think it was already fixed at r39179. (thx narse-san)

Updated by nagachika (Tomoyuki Chikanaga) almost 7 years ago

  • 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.

Updated by kosaki (Motohiro KOSAKI) almost 7 years ago

  • Status changed from Open to Assigned
#4

Updated by kosaki (Motohiro KOSAKI) almost 7 years ago

  • 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]

Updated by kosaki (Motohiro KOSAKI) almost 7 years ago

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.

#6

Updated by nagachika (Tomoyuki Chikanaga) almost 7 years ago

  • 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.

#7

Updated by nagachika (Tomoyuki Chikanaga) almost 7 years ago

  • 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