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

**URL:** <https://www.ruby-forum.com/t/ruby-trunk-bug-7589-open-parallel-test-all-test-settracefunc-segv/225166>\
**Category:** Development\
**Created:** [December 19, 2012, 4:01am UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-7589-open-parallel-test-all-test-settracefunc-segv/225166 "2012-12-19T04:01:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 19, 2012, 4:01am UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-7589-open-parallel-test-all-test-settracefunc-segv/225166/1 "2012-12-19T04:01:25Z")

</div>

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

* * *

Bug #7589: parallel test-all で test\_settracefunc が SEGV

> **[Bug #7589: parallel test-all で test\_settracefunc が SEGV - Ruby master - Ruby...](https://bugs.ruby-lang.org/issues/7589)**
>
> Redmine

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

```

---

<div class="post-metadata">

**Author:** ![naruse\_SYui\_NARUSE](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/a8b319/32.png) [@naruse\_SYui\_NARUSE](https://www.ruby-forum.com/u/naruse_SYui_NARUSE)\
**Post date:** [December 19, 2012, 12:28pm UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-7589-open-parallel-test-all-test-settracefunc-segv/225166/2 "2012-12-19T12:28:33Z")

</div>

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

> **[Updated by kosaki (Motohiro KOSAKI) almost 14 years ago ActionsCopy link 2... -...](https://bugs.ruby-lang.org/issues/7589#change-34845)**
>
> This issue was solved with changeset r38464. Yui, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you. | Redmine

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

```

---

<div class="post-metadata">

**Author:** ![naruse\_SYui\_NARUSE](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/a8b319/32.png) [@naruse\_SYui\_NARUSE](https://www.ruby-forum.com/u/naruse_SYui_NARUSE)\
**Post date:** [December 19, 2012, 12:30pm UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-7589-open-parallel-test-all-test-settracefunc-segv/225166/3 "2012-12-19T12:30:53Z")

</div>

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

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

Bug #7589: parallel test-all で test\_settracefunc が SEGV

> **[Updated by kosaki (Motohiro KOSAKI) almost 14 years ago ActionsCopy link 3... -...](https://bugs.ruby-lang.org/issues/7589#change-34846)**
>
> This issue was solved with changeset r38464. Yui, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you. | Redmine

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

```
