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

ruby-changes:69409

From: Koichi <ko1@a...>
Date: Mon, 25 Oct 2021 15:47:56 +0900 (JST)
Subject: [ruby-changes:69409] 7864efa105 (master): introduce check code for mysterious EBADF

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

From 7864efa105921eb3900c843126f2e0db02b9c6ae Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Mon, 25 Oct 2021 15:43:46 +0900
Subject: introduce check code for mysterious EBADF

parallel test randomly failed with EBADF.
This patch checks wich suite causes this error.

ex) http://ci.rvm.jp/results/trunk@ruby-iga/3690219

```
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:88:in `close': Bad file descriptor (Errno::EBADF)
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:88:in `ensure in _run_suite'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:89:in `_run_suite'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:30:in `block in _run_suites'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:29:in `map'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:29:in `_run_suites'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:128:in `run'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:211:in `<main>'
```
---
 tool/lib/test/unit/parallel.rb | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/tool/lib/test/unit/parallel.rb b/tool/lib/test/unit/parallel.rb
index b3a8957f26e..544239921cb 100644
--- a/tool/lib/test/unit/parallel.rb
+++ b/tool/lib/test/unit/parallel.rb
@@ -85,8 +85,21 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/parallel.rb#L85
         Test::Unit::Runner.output = orig_stdout
         $stdin = orig_stdin if orig_stdin
         $stdout = orig_stdout if orig_stdout
-        o.close if o && !o.closed?
-        i.close if i && !i.closed?
+
+        # To figure out which suite raises EBADF error.
+        begin
+          o.close if o && !o.closed?
+        rescue Exception => e
+          STDERR.puts "#{e} at #{suite.name} (o)"
+          raise
+        end
+
+        begin
+          i.close if i && !i.closed?
+        rescue Exception => e
+          STDERR.puts "#{e} at #{suite.name} (i)"
+          raise
+        end
       end
 
       def run(args = []) # :nodoc:
-- 
cgit v1.2.1


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

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