[ruby-trunk - Bug #7589][Open] parallel test-all で test settracefunc が SEGV

Issue #7589 has been reported by naruse (Yui NARUSE).


Bug #7589: parallel test-all で test_settracefunc が SEGV

Author: naruse (Yui NARUSE)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-19 trunk 38456) [x86_64-linux]

while make TESTS=‘-qv -j1 ruby/test_settracefunc.rb’ test-all;do done
としていると以下の通りSEGVします。

前略
TestSetTraceFunc#test_tracepoint_exception_at_line = 0.00 s = .
/home/naruse/ruby/lib/test/unit/parallel.rb:38: [BUG] Segmentation fault
ruby 2.0.0dev (2012-12-19 trunk 38456) [x86_64-linux]

– Control frame information

c:0002 p:0014 s:0005 e:000004 BLOCK
/home/naruse/ruby/lib/test/unit/parallel.rb:38 [FINISH]
c:0001 p:---- s:0002 e:000001 TOP [FINISH]

– Ruby level backtrace information

/home/naruse/ruby/lib/test/unit/parallel.rb:38:in `block in _run_suite’

– C level backtrace information

/home/naruse/ruby/libruby.so.2.0.0(+0x1be874) [0x2b09de81b874]
vm_dump.c:643
/home/naruse/ruby/libruby.so.2.0.0(+0x662a7) [0x2b09de6c32a7]
error.c:306
/home/naruse/ruby/libruby.so.2.0.0(rb_bug+0x108) [0x2b09de6c33e5]
error.c:325
/home/naruse/ruby/libruby.so.2.0.0(+0x1382f2) [0x2b09de7952f2]
signal.c:649
/lib/libpthread.so.0(+0xf8f0) [0x2b09deb188f0]
…/nptl/sysdeps/pthread/funlockfile.c:30
/home/naruse/ruby/libruby.so.2.0.0(+0x1c13e8) [0x2b09de81e3e8]
vm_trace.c:263
/home/naruse/ruby/libruby.so.2.0.0(+0x1c160f) [0x2b09de81e60f]
vm_trace.c:309
/home/naruse/ruby/libruby.so.2.0.0(+0x1aba95) [0x2b09de808a95]
/home/naruse/ruby/libruby.so.2.0.0(+0x1baaca) [0x2b09de817aca] vm.c:1169
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9618) [0x2b09de816618] vm.c:636
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9869) [0x2b09de816869] vm.c:684
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9917) [0x2b09de816917] vm.c:703
/home/naruse/ruby/libruby.so.2.0.0(+0x1c56cf) [0x2b09de8226cf]
/home/naruse/ruby/libruby.so.2.0.0(+0x1c4111) [0x2b09de821111]
thread_pthread.c:722
/lib/libpthread.so.0(+0x69ca) [0x2b09deb0f9ca] pthread_create.c:300
/lib/libc.so.6(clone+0x6d) [0x2b09df6d921d] parse.y:10551

– Other runtime information

  • Loaded script: /home/naruse/ruby/lib/test/unit/parallel.rb:
    TestSetTraceFunc#test_tracepoint_thread

  • Loaded features:

Some worker was crashed. It seems ruby interpreter’s bug
or, a bug of test/unit/parallel.rb. try again without -j
option.

make: *** [yes-test-all] Error 1

以下のパッチを当てると落ちなくなるので、パイプの読み込み部分があやしそうですが……。

diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index d189183…b044792 100644
— a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -34,8 +34,13 @@ module Test

     th = Thread.new do
       begin
  •        while buf = (self.verbose ? i.gets : i.read(5))
    
  •          _report "p", buf
    
  •        buf = i.read
    
  •        if self.verbose
    
  •          buf.each_line{|l|
    
  •          _report "p", l
    
  •          }
    
  •        else
    
  •          raise
           end
         rescue IOError
         rescue Errno::EPIPE
    

Issue #7589 has been updated by kosaki (Motohiro KOSAKI).

あれ、まだ起きるような。
うちのx86_64 linuxだと以下のように vm_call_cfunc - cfp consistency error
でrb_bugして、その延長でsegv.
ところで、一般論としてcfp consistency errorが起きてる時に ruby level
backtraceが採取できる可能性はないんじゃないですかね。

#0 0x00007f0bedb7fec3 in fill_lines (num_traces=23,
traces=0x7f0bede50060, syms=0x7f0bee141eb0, check_debuglink=1,
current_line=0x7f0bee1427a0, lines=0x7f0bee1427a0)
at …/addr2line.c:513
#1 0x00007f0bedb80219 in rb_dump_backtrace_with_lines (num_traces=23,
trace=0x7f0bede50060, syms=0x7f0bee141eb0) at …/addr2line.c:605
#2 0x00007f0bedb6b97f in rb_vm_bugreport () at …/vm_dump.c:648
#3 0x00007f0beda11f79 in report_bug (
file=0x7f0bee203fe0 “/home/kosaki/ruby/git/lib/minitest/unit.rb”,
line=912, fmt=0x7f0bedba37ff “Segmentation fault”,
args=0x7f0bee068880) at …/error.c:306
#4 0x00007f0beda120b7 in rb_bug (fmt=0x7f0bedba37ff “Segmentation
fault”)
at …/error.c:325
#5 0x00007f0bedae3c39 in sigsegv (sig=11, info=0x7f0bee068af0,
ctx=0x7f0bee0689c0) at …/signal.c:649
#6
#7 0x00007f0bedb7fec3 in fill_lines (num_traces=16,
traces=0x7f0bede50060, syms=0x7f0bee66ab00, check_debuglink=1,
current_line=0x7f0bee66b150, lines=0x7f0bee66b150)
at …/addr2line.c:513
#8 0x00007f0bedb80219 in rb_dump_backtrace_with_lines (num_traces=16,
trace=0x7f0bede50060, syms=0x7f0bee66ab00) at …/addr2line.c:605
#9 0x00007f0bedb6b97f in rb_vm_bugreport () at …/vm_dump.c:648
#10 0x00007f0beda11f79 in report_bug (
file=0x7f0bee203fe0 “/home/kosaki/ruby/git/lib/minitest/unit.rb”,
line=912, fmt=0x7f0bedba9aa8 “vm_call_cfunc - cfp consistency
error”,
args=0x7fff16fcf500) at …/error.c:306
#11 0x00007f0beda120b7 in rb_bug (
fmt=0x7f0bedba9aa8 “vm_call_cfunc - cfp consistency error”)
at …/error.c:325
#12 0x00007f0bedb53530 in vm_call_cfunc_with_frame (th=0x7f0bedffe5b0,
reg_cfp=0x7f0bed99eeb0, ci=0x7f0bee17b750) at
…/vm_insnhelper.c:1422
#13 0x00007f0bedb537cc in vm_call_cfunc (th=0x7f0bedffe5b0,
reg_cfp=0x7f0bed99eeb0, ci=0x7f0bee17b750) at
…/vm_insnhelper.c:1509
#14 0x00007f0bedb545b6 in vm_call_method (th=0x7f0bedffe5b0,
cfp=0x7f0bed99eeb0, ci=0x7f0bee17b750) at …/vm_insnhelper.c:1683
#15 0x00007f0bedb54d71 in vm_call_general (th=0x7f0bedffe5b0,
reg_cfp=0x7f0bed99eeb0, ci=0x7f0bee17b750) at
…/vm_insnhelper.c:1832
#16 0x00007f0bedb58951 in vm_exec_core (th=0x7f0bedffe5b0, initial=0)
at …/insns.def:996
#17 0x00007f0bedb67785 in vm_exec (th=0x7f0bedffe5b0) at …/vm.c:1169
#18 0x00007f0bedb6879b in rb_iseq_eval_main (iseqval=139689214591600)
at …/vm.c:1417
#19 0x00007f0beda178c8 in ruby_exec_internal (n=0x7f0bee03c270)
at …/eval.c:250
#20 0x00007f0beda179db in ruby_exec_node (n=0x7f0bee03c270)
at …/eval.c:315
#21 0x00007f0beda179ae in ruby_run_node (n=0x7f0bee03c270)
at …/eval.c:307
#22 0x00007f0bed9d8ef9 in main (argc=6, argv=0x7fff16fd0898)
at …/main.c:36


Bug #7589: parallel test-all で test_settracefunc が SEGV

Author: naruse (Yui NARUSE)
Status: Closed
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-19 trunk 38456) [x86_64-linux]

while make TESTS=‘-qv -j1 ruby/test_settracefunc.rb’ test-all;do done
としていると以下の通りSEGVします。

前略
TestSetTraceFunc#test_tracepoint_exception_at_line = 0.00 s = .
/home/naruse/ruby/lib/test/unit/parallel.rb:38: [BUG] Segmentation fault
ruby 2.0.0dev (2012-12-19 trunk 38456) [x86_64-linux]

– Control frame information

c:0002 p:0014 s:0005 e:000004 BLOCK
/home/naruse/ruby/lib/test/unit/parallel.rb:38 [FINISH]
c:0001 p:---- s:0002 e:000001 TOP [FINISH]

– Ruby level backtrace information

/home/naruse/ruby/lib/test/unit/parallel.rb:38:in `block in _run_suite’

– C level backtrace information

/home/naruse/ruby/libruby.so.2.0.0(+0x1be874) [0x2b09de81b874]
vm_dump.c:643
/home/naruse/ruby/libruby.so.2.0.0(+0x662a7) [0x2b09de6c32a7]
error.c:306
/home/naruse/ruby/libruby.so.2.0.0(rb_bug+0x108) [0x2b09de6c33e5]
error.c:325
/home/naruse/ruby/libruby.so.2.0.0(+0x1382f2) [0x2b09de7952f2]
signal.c:649
/lib/libpthread.so.0(+0xf8f0) [0x2b09deb188f0]
…/nptl/sysdeps/pthread/funlockfile.c:30
/home/naruse/ruby/libruby.so.2.0.0(+0x1c13e8) [0x2b09de81e3e8]
vm_trace.c:263
/home/naruse/ruby/libruby.so.2.0.0(+0x1c160f) [0x2b09de81e60f]
vm_trace.c:309
/home/naruse/ruby/libruby.so.2.0.0(+0x1aba95) [0x2b09de808a95]
/home/naruse/ruby/libruby.so.2.0.0(+0x1baaca) [0x2b09de817aca] vm.c:1169
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9618) [0x2b09de816618] vm.c:636
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9869) [0x2b09de816869] vm.c:684
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9917) [0x2b09de816917] vm.c:703
/home/naruse/ruby/libruby.so.2.0.0(+0x1c56cf) [0x2b09de8226cf]
/home/naruse/ruby/libruby.so.2.0.0(+0x1c4111) [0x2b09de821111]
thread_pthread.c:722
/lib/libpthread.so.0(+0x69ca) [0x2b09deb0f9ca] pthread_create.c:300
/lib/libc.so.6(clone+0x6d) [0x2b09df6d921d] parse.y:10551

– Other runtime information

  • Loaded script: /home/naruse/ruby/lib/test/unit/parallel.rb:
    TestSetTraceFunc#test_tracepoint_thread

  • Loaded features:

Some worker was crashed. It seems ruby interpreter’s bug
or, a bug of test/unit/parallel.rb. try again without -j
option.

make: *** [yes-test-all] Error 1

以下のパッチを当てると落ちなくなるので、パイプの読み込み部分があやしそうですが……。

diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index d189183…b044792 100644
— a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -34,8 +34,13 @@ module Test

     th = Thread.new do
       begin
  •        while buf = (self.verbose ? i.gets : i.read(5))
    
  •          _report "p", buf
    
  •        buf = i.read
    
  •        if self.verbose
    
  •          buf.each_line{|l|
    
  •          _report "p", l
    
  •          }
    
  •        else
    
  •          raise
           end
         rescue IOError
         rescue Errno::EPIPE
    

Issue #7589 has been updated by kosaki (Motohiro KOSAKI).

あ、taruiさんが #7590としてすでに報告済みでした。そちらに転記しておきます

Bug #7589: parallel test-all で test_settracefunc が SEGV

Author: naruse (Yui NARUSE)
Status: Closed
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-19 trunk 38456) [x86_64-linux]

while make TESTS=‘-qv -j1 ruby/test_settracefunc.rb’ test-all;do done
としていると以下の通りSEGVします。

前略
TestSetTraceFunc#test_tracepoint_exception_at_line = 0.00 s = .
/home/naruse/ruby/lib/test/unit/parallel.rb:38: [BUG] Segmentation fault
ruby 2.0.0dev (2012-12-19 trunk 38456) [x86_64-linux]

– Control frame information

c:0002 p:0014 s:0005 e:000004 BLOCK
/home/naruse/ruby/lib/test/unit/parallel.rb:38 [FINISH]
c:0001 p:---- s:0002 e:000001 TOP [FINISH]

– Ruby level backtrace information

/home/naruse/ruby/lib/test/unit/parallel.rb:38:in `block in _run_suite’

– C level backtrace information

/home/naruse/ruby/libruby.so.2.0.0(+0x1be874) [0x2b09de81b874]
vm_dump.c:643
/home/naruse/ruby/libruby.so.2.0.0(+0x662a7) [0x2b09de6c32a7]
error.c:306
/home/naruse/ruby/libruby.so.2.0.0(rb_bug+0x108) [0x2b09de6c33e5]
error.c:325
/home/naruse/ruby/libruby.so.2.0.0(+0x1382f2) [0x2b09de7952f2]
signal.c:649
/lib/libpthread.so.0(+0xf8f0) [0x2b09deb188f0]
…/nptl/sysdeps/pthread/funlockfile.c:30
/home/naruse/ruby/libruby.so.2.0.0(+0x1c13e8) [0x2b09de81e3e8]
vm_trace.c:263
/home/naruse/ruby/libruby.so.2.0.0(+0x1c160f) [0x2b09de81e60f]
vm_trace.c:309
/home/naruse/ruby/libruby.so.2.0.0(+0x1aba95) [0x2b09de808a95]
/home/naruse/ruby/libruby.so.2.0.0(+0x1baaca) [0x2b09de817aca] vm.c:1169
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9618) [0x2b09de816618] vm.c:636
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9869) [0x2b09de816869] vm.c:684
/home/naruse/ruby/libruby.so.2.0.0(+0x1b9917) [0x2b09de816917] vm.c:703
/home/naruse/ruby/libruby.so.2.0.0(+0x1c56cf) [0x2b09de8226cf]
/home/naruse/ruby/libruby.so.2.0.0(+0x1c4111) [0x2b09de821111]
thread_pthread.c:722
/lib/libpthread.so.0(+0x69ca) [0x2b09deb0f9ca] pthread_create.c:300
/lib/libc.so.6(clone+0x6d) [0x2b09df6d921d] parse.y:10551

– Other runtime information

  • Loaded script: /home/naruse/ruby/lib/test/unit/parallel.rb:
    TestSetTraceFunc#test_tracepoint_thread

  • Loaded features:

Some worker was crashed. It seems ruby interpreter’s bug
or, a bug of test/unit/parallel.rb. try again without -j
option.

make: *** [yes-test-all] Error 1

以下のパッチを当てると落ちなくなるので、パイプの読み込み部分があやしそうですが……。

diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index d189183…b044792 100644
— a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -34,8 +34,13 @@ module Test

     th = Thread.new do
       begin
  •        while buf = (self.verbose ? i.gets : i.read(5))
    
  •          _report "p", buf
    
  •        buf = i.read
    
  •        if self.verbose
    
  •          buf.each_line{|l|
    
  •          _report "p", l
    
  •          }
    
  •        else
    
  •          raise
           end
         rescue IOError
         rescue Errno::EPIPE