Forum: Ruby-core [ruby-trunk - Bug #7826][Assigned] test_setsid rarely fails with Errno::ESRCH at Process.getsid(io.p

Posted by nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-02-11 14:00
(Received via mailing list)
Issue #7826 has been reported by nagachika (Tomoyuki Chikanaga).

----------------------------------------
Bug #7826: test_setsid rarely fails with Errno::ESRCH at 
Process.getsid(io.pid)
https://bugs.ruby-lang.org/issues/7826

Author: nagachika (Tomoyuki Chikanaga)
Status: Assigned
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: test
Target version:
ruby -v: ruby 2.0.0dev (2012-12-30 trunk 38661) [x86_64-darwin10.8.0]


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
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-11 19:09
(Received via mailing list)
Issue #7826 has been updated by kosaki (Motohiro KOSAKI).

Status changed from Assigned to Closed

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

----------------------------------------
Bug #7826: test_setsid rarely fails with Errno::ESRCH at 
Process.getsid(io.pid)
https://bugs.ruby-lang.org/issues/7826#change-36148

Author: nagachika (Tomoyuki Chikanaga)
Status: Closed
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: test
Target version:
ruby -v: ruby 2.0.0dev (2012-12-30 trunk 38661) [x86_64-darwin10.8.0]


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
Posted by nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-02-12 16:05
(Received via mailing list)
Issue #7826 has been updated by nagachika (Tomoyuki Chikanaga).

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.
----------------------------------------
Bug #7826: test_setsid rarely fails with Errno::ESRCH at 
Process.getsid(io.pid)
https://bugs.ruby-lang.org/issues/7826#change-36174

Author: nagachika (Tomoyuki Chikanaga)
Status: Open
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: test
Target version:
ruby -v: ruby 2.0.0dev (2013-02-11 trunk 39204) [x86_64-darwin10.8.0]


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
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-13 01:01
(Received via mailing list)
Issue #7826 has been updated by kosaki (Motohiro KOSAKI).

Status changed from Open to Assigned


----------------------------------------
Bug #7826: test_setsid rarely fails with Errno::ESRCH at 
Process.getsid(io.pid)
https://bugs.ruby-lang.org/issues/7826#change-36183

Author: nagachika (Tomoyuki Chikanaga)
Status: Assigned
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: test
Target version:
ruby -v: ruby 2.0.0dev (2013-02-11 trunk 39204) [x86_64-darwin10.8.0]


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
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-14 21:04
(Received via mailing list)
Issue #7826 has been updated by kosaki (Motohiro KOSAKI).


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.
----------------------------------------
Bug #7826: test_setsid rarely fails with Errno::ESRCH at 
Process.getsid(io.pid)
https://bugs.ruby-lang.org/issues/7826#change-36296

Author: nagachika (Tomoyuki Chikanaga)
Status: Closed
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: test
Target version:
ruby -v: ruby 2.0.0dev (2013-02-11 trunk 39204) [x86_64-darwin10.8.0]


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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.