[前][次][番号順一覧][スレッド一覧]

ruby-changes:61172

From: Takashi <ko1@a...>
Date: Sun, 10 May 2020 14:38:13 +0900 (JST)
Subject: [ruby-changes:61172] a6f8589914 (master): Workaround a zombie process created by Open3

https://git.ruby-lang.org/ruby.git/commit/?id=a6f8589914

From a6f85899144607606c114e95104fa7e8ec8d95d9 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sat, 9 May 2020 22:36:30 -0700
Subject: Workaround a zombie process created by Open3

with MJIT worker enabled

The problem:

```
$ ruby -ropen3 --jit -e 'Open3.capture2e("cmake") rescue nil;binding.irb'
irb(main)[01:0]> Process.waitall
=> [[10656, #<Process::Status: pid 10656 exit 127>]]

$ ruby -ropen3 -e 'Open3.capture2e("cmake") rescue nil;binding.irb'
irb(main)[01:0]> Process.waitall
=> []
```

Not sure why it's happening yet, but first I'd like to prevent trunk-mjit-wait
from failing like http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2929075.

diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb
index b3f9241..d056202 100644
--- a/test/rubygems/test_gem_ext_cmake_builder.rb
+++ b/test/rubygems/test_gem_ext_cmake_builder.rb
@@ -14,6 +14,14 @@ class TestGemExtCmakeBuilder < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_ext_cmake_builder.rb#L14
       _, status = Open3.capture2e('cmake')
       skip 'cmake not present' unless status.success?
     rescue Errno::ENOENT
+      # Open3.capture2e with ENOENT with JIT enabled leaves a zombie process.
+      # TODO: avoid making the zombie on ENOENT with JIT
+      if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
+        begin
+          Process.waitall
+        rescue Errno::ECHILD
+        end
+      end
       skip 'cmake not present'
     end
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]