Project

General

Profile

Backport #5074

"[BUG] cfp consistency error - send" on TestEnumerator#test_feed_yielder (test/ruby/test_enumerator.rb)

Added by sorah (Sorah Fukumori) almost 9 years ago. Updated about 4 years ago.

Status:
Rejected
Priority:
Normal
[ruby-dev:44185]

Description

sora_hです。
OS X Lion, 10.7.0 でtest_enumerator.rbでクラッシュします。

gcc --version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
ruby -v: ruby 1.9.4dev (2011-07-22 trunk 32614) [x86_64-darwin11.0.0]
configure: ../../configure --prefix=pwd/local --with-readline-dir=$HOME/brew --enable-shared --enable-pthread --disable-install-doc --with-arch=x86_64 debugflags="-gdwarf-2 -g3" optflags="-O3"

以下ログ:

./miniruby -I../../lib -I. -I.ext/common ../../tool/runruby.rb --extout=.ext -- --disable-gems "../../test/runner.rb" --ruby="./miniruby -I../../lib -I. -I.ext/common ../../tool/runruby.rb --extout=.ext -- --disable-gems" -v -q ruby/test_enumerator.rb
Run options: "--ruby=./miniruby -I../../lib -I. -I.ext/common ../../tool/runruby.rb --extout=.ext -- --disable-gems" -v -q

Running tests:

TestEnumerator#test_cons = 0.00 s = .
TestEnumerator#test_feed = 0.00 s = .
TestEnumerator#test_feed_before_first_next = 0.00 s = .
TestEnumerator#test_feed_mixed = 0.00 s = .
TestEnumerator#test_feed_twice = 0.00 s = .
TestEnumerator#test_feed_yielder = /Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb:328: [BUG] cfp consistency error - send
ruby 1.9.4dev (2011-07-22 trunk 32614) [x86_64-darwin11.0.0]

-- Control frame information -----------------------------------------------
c:0025 p:---- s:0102 b:0102 l:0014a0 d:0014a0 CFUNC :next
c:0024 p:0034 s:0099 b:0099 l:0013e0 d:0013e0 METHOD /Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb:328
c:0023 p:0063 s:0093 b:0093 l:001080 d:001080 METHOD /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:948
c:0022 p:0025 s:0087 b:0087 l:000086 d:000086 METHOD /Users/sorah/git/ruby/ruby/lib/test/unit/testcase.rb:17
c:0021 p:0090 s:0083 b:0083 l:000071 d:000082 BLOCK /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:787
c:0020 p:---- s:0077 b:0077 l:000076 d:000076 FINISH
c:0019 p:---- s:0075 b:0075 l:000074 d:000074 CFUNC :map
c:0018 p:0124 s:0072 b:0072 l:000071 d:000071 METHOD /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:780
c:0017 p:0020 s:0064 b:0063 l:000053 d:000062 BLOCK /Users/sorah/git/ruby/ruby/lib/test/unit.rb:565
c:0016 p:---- s:0059 b:0059 l:000058 d:000058 FINISH
c:0015 p:---- s:0057 b:0057 l:000056 d:000056 CFUNC :each
c:0014 p:0053 s:0054 b:0054 l:000053 d:000053 METHOD /Users/sorah/git/ruby/ruby/lib/test/unit.rb:563
c:0013 p:0189 s:0048 b:0048 l:000047 d:000047 METHOD /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:746
c:0012 p:0013 s:0038 b:0038 l:000037 d:000037 METHOD /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:909
c:0011 p:0012 s:0035 b:0035 l:000026 d:000034 BLOCK /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:896
c:0010 p:---- s:0032 b:0032 l:000031 d:000031 FINISH
c:0009 p:---- s:0030 b:0030 l:000029 d:000029 CFUNC :each
c:0008 p:0068 s:0027 b:0027 l:000026 d:000026 METHOD /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:895
c:0007 p:0029 s:0023 b:0023 l:000022 d:000022 METHOD /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:884
c:0006 p:0022 s:0019 b:0019 l:000018 d:000018 METHOD /Users/sorah/git/ruby/ruby/lib/test/unit.rb:21
c:0005 p:0016 s:0015 b:0015 l:000014 d:000014 METHOD /Users/sorah/git/ruby/ruby/lib/test/unit.rb:630
c:0004 p:0019 s:0012 b:0012 l:000011 d:000011 METHOD /Users/sorah/git/ruby/ruby/lib/test/unit.rb:634
c:0003 p:0156 s:0008 b:0007 l:001688 d:000830 EVAL ../../test/runner.rb:15
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001688 d:001688 TOP

-- Ruby level backtrace information ----------------------------------------
../../test/runner.rb:15:in <main>'
/Users/sorah/git/ruby/ruby/lib/test/unit.rb:634:in
run'
/Users/sorah/git/ruby/ruby/lib/test/unit.rb:630:in run'
/Users/sorah/git/ruby/ruby/lib/test/unit.rb:21:in
run'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:884:in run'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:895:in
_run'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:895:in each'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:896:in
block in _run'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:909:in run_tests'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:746:in
_run_anything'
/Users/sorah/git/ruby/ruby/lib/test/unit.rb:563:in _run_suites'
/Users/sorah/git/ruby/ruby/lib/test/unit.rb:563:in
each'
/Users/sorah/git/ruby/ruby/lib/test/unit.rb:565:in block in _run_suites'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:780:in
_run_suite'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:780:in map'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:787:in
block in _run_suite'
/Users/sorah/git/ruby/ruby/lib/test/unit/testcase.rb:17:in run'
/Users/sorah/git/ruby/ruby/lib/minitest/unit.rb:948:in
run'
/Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb:328:in test_feed_yielder'
/Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb:328:in
next'

-- C level backtrace information -------------------------------------------

See Crash Report log file under ~/Library/Logs/CrashReporter or
/Library/Logs/CrashReporter, for the more detail of.

-- Other runtime information -----------------------------------------------

  • Loaded script: ../../test/runner.rb

  • Loaded features:

    0 enumerator.so
    1 /Users/sorah/git/ruby/ruby/builds/lion/.ext/x86_64-darwin11.0.0/enc/encdb.bundle
    2 /Users/sorah/git/ruby/ruby/builds/lion/.ext/x86_64-darwin11.0.0/enc/trans/transdb.bundle
    3 /Users/sorah/git/ruby/ruby/builds/lion/rbconfig.rb
    4 /Users/sorah/git/ruby/ruby/lib/optparse.rb
    5 /Users/sorah/git/ruby/ruby/lib/minitest/unit.rb
    6 /Users/sorah/git/ruby/ruby/lib/prettyprint.rb
    7 /Users/sorah/git/ruby/ruby/lib/pp.rb
    8 /Users/sorah/git/ruby/ruby/lib/test/unit/assertions.rb
    9 /Users/sorah/git/ruby/ruby/lib/test/unit/testcase.rb
    10 /Users/sorah/git/ruby/ruby/lib/test/unit.rb
    11 /Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

make: *** [yes-test-all] Abort trap: 6


Process: ruby [39285]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: gnumake [37340]

Date/Time: 2011-07-22 14:52:10.251 +0900
OS Version: Mac OS X 10.7 (11A511)
Report Version: 9

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
objc[39285]: garbage collection is OFF
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8e6abce2 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff88bd07d2 pthread_kill + 95
2 libsystem_c.dylib 0x00007fff88bc1a7a abort + 143
3 libruby.1.9.1.dylib 0x0000000105feee39 rb_bug + 185
4 libruby.1.9.1.dylib 0x00000001060f091f vm_call_method + 2511 (vm_insnhelper.c:407)
5 libruby.1.9.1.dylib 0x00000001060f38ee vm_exec_core + 11726 (insns.def:1012)
6 libruby.1.9.1.dylib 0x00000001060f7a6e vm_exec + 94 (vm.c:1181)
7 libruby.1.9.1.dylib 0x00000001060f8986 rb_yield + 70 (vm_eval.c:747)
8 libruby.1.9.1.dylib 0x0000000105fc285b rb_ary_collect + 123 (array.c:2220)
9 libruby.1.9.1.dylib 0x00000001060ebd80 call_cfunc + 112 (vm_insnhelper.c:320)
10 libruby.1.9.1.dylib 0x00000001060f0233 vm_call_method + 739 (vm_insnhelper.c:404)
11 libruby.1.9.1.dylib 0x00000001060f38ee vm_exec_core + 11726 (insns.def:1012)
12 libruby.1.9.1.dylib 0x00000001060f7a6e vm_exec + 94 (vm.c:1181)
13 libruby.1.9.1.dylib 0x00000001060f8986 rb_yield + 70 (vm_eval.c:747)
14 libruby.1.9.1.dylib 0x0000000105fc191f rb_ary_each + 95 (array.c:1477)
15 libruby.1.9.1.dylib 0x00000001060ebd80 call_cfunc + 112 (vm_insnhelper.c:320)
16 libruby.1.9.1.dylib 0x00000001060f0233 vm_call_method + 739 (vm_insnhelper.c:404)
17 libruby.1.9.1.dylib 0x00000001060f38ee vm_exec_core + 11726 (insns.def:1012)
18 libruby.1.9.1.dylib 0x00000001060f7a6e vm_exec + 94 (vm.c:1181)
19 libruby.1.9.1.dylib 0x00000001060f8986 rb_yield + 70 (vm_eval.c:747)
20 libruby.1.9.1.dylib 0x0000000105fc191f rb_ary_each + 95 (array.c:1477)
21 libruby.1.9.1.dylib 0x00000001060ebd80 call_cfunc + 112 (vm_insnhelper.c:320)
22 libruby.1.9.1.dylib 0x00000001060f0233 vm_call_method + 739 (vm_insnhelper.c:404)
23 libruby.1.9.1.dylib 0x00000001060f38ee vm_exec_core + 11726 (insns.def:1012)
24 libruby.1.9.1.dylib 0x00000001060f7a6e vm_exec + 94 (vm.c:1181)
25 libruby.1.9.1.dylib 0x00000001060f81c3 rb_iseq_eval_main + 275 (vm.c:1422)
26 libruby.1.9.1.dylib 0x0000000105ff16ef ruby_exec_internal + 111 (eval.c:209)
27 libruby.1.9.1.dylib 0x0000000105ff26d2 ruby_run_node + 82 (eval.c:251)
28 ruby 0x0000000105fb5ecf main + 79 (main.c:38)
29 ruby 0x0000000105fb5e74 start + 52

Thread 1:
0 libsystem_kernel.dylib 0x00007fff8e6abdf2 __select + 10
1 libruby.1.9.1.dylib 0x00000001060fee21 thread_timer + 417 (thread_pthread.c:1137)
2 libsystem_c.dylib 0x00007fff88bce8bf _pthread_start + 335
3 libsystem_c.dylib 0x00007fff88bd1b75 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx: 0x00007fff65bb2a48 rdx: 0x0000000000000000
rdi: 0x0000000000002307 rsi: 0x0000000000000006 rbp: 0x00007fff65bb2a70 rsp: 0x00007fff65bb2a48
r8: 0x00007fff7661bfb8 r9: 0x00007fff65bb25f8 r10: 0x00007fff8e6abd0a r11: 0xffffff80002d8240
r12: 0x00000001064ff7c0 r13: 0x0000000106380ec0 r14: 0x00007fff7661e960 r15: 0x0000000000000008
rip: 0x00007fff8e6abce2 rfl: 0x0000000000000246 cr2: 0x00007faf50a0e000
Logical CPU: 0

Binary Images:
0x105fb5000 - 0x105fb5ff7 +ruby (??? - ???) /Users/USER//ruby
0x105fba000 - 0x10619afef +libruby.1.9.1.dylib (1.9.1 - compatibility 1.9.1) /Users/USER/
/libruby.1.9.1.dylib
0x1062c1000 - 0x1062c2ff7 +encdb.bundle (??? - ???) /Users/USER//encdb.bundle
0x1062c5000 - 0x1062c6fff +transdb.bundle (??? - ???) /Users/USER/
/transdb.bundle
0x7fff65bb5000 - 0x7fff65be9ac7 dyld (195.5 - ???) /usr/lib/dyld
0x7fff8737a000 - 0x7fff87384ff7 liblaunch.dylib (392.18.0 - compatibility 1.0.0) /usr/lib/system/liblaunch.dylib
0x7fff885a4000 - 0x7fff88619ff7 libc++.1.dylib (19.0.0 - compatibility 1.0.0) /usr/lib/libc++.1.dylib
0x7fff886bf000 - 0x7fff886caff7 libc++abi.dylib (14.0.0 - compatibility 1.0.0) /usr/lib/libc++abi.dylib
0x7fff88921000 - 0x7fff88926fff libcache.dylib (47.0.0 - compatibility 1.0.0) /usr/lib/system/libcache.dylib
0x7fff88a0b000 - 0x7fff88a13fff libsystem_dnssd.dylib (??? - ???) /usr/lib/system/libsystem_dnssd.dylib
0x7fff88b80000 - 0x7fff88c5dfef libsystem_c.dylib (763.11.0 - compatibility 1.0.0) /usr/lib/system/libsystem_c.dylib
0x7fff89a24000 - 0x7fff89a25fff libdnsinfo.dylib (395.6.0 - compatibility 1.0.0) /usr/lib/system/libdnsinfo.dylib
0x7fff8a62c000 - 0x7fff8a62dfff libsystem_sandbox.dylib (??? - ???) /usr/lib/system/libsystem_sandbox.dylib
0x7fff8a62e000 - 0x7fff8a66afff libsystem_info.dylib (??? - ???) /usr/lib/system/libsystem_info.dylib
0x7fff8a66b000 - 0x7fff8a679fff libdispatch.dylib (187.5.0 - compatibility 1.0.0) /usr/lib/system/libdispatch.dylib
0x7fff8a856000 - 0x7fff8a858fff libquarantine.dylib (36.0.0 - compatibility 1.0.0) /usr/lib/system/libquarantine.dylib
0x7fff8a8cf000 - 0x7fff8a8d5ff7 libunwind.dylib (30.0.0 - compatibility 1.0.0) /usr/lib/system/libunwind.dylib
0x7fff8aa0c000 - 0x7fff8aa29ff7 libxpc.dylib (77.16.0 - compatibility 1.0.0) /usr/lib/system/libxpc.dylib
0x7fff8abaa000 - 0x7fff8ac8edef libobjc.A.dylib (228.0.0 - compatibility 1.0.0) /usr/lib/libobjc.A.dylib
0x7fff8cf15000 - 0x7fff8cf63ff7 libauto.dylib (??? - ???) /usr/lib/libauto.dylib
0x7fff8da1b000 - 0x7fff8da1bfff libkeymgr.dylib (23.0.0 - compatibility 1.0.0) /usr/lib/system/libkeymgr.dylib
0x7fff8e099000 - 0x7fff8e0dbff7 libcommonCrypto.dylib (55010.0.0 - compatibility 1.0.0) /usr/lib/system/libcommonCrypto.dylib
0x7fff8e124000 - 0x7fff8e151fe7 libSystem.B.dylib (159.0.0 - compatibility 1.0.0) /usr/lib/libSystem.B.dylib
0x7fff8e596000 - 0x7fff8e597ff7 libremovefile.dylib (21.0.0 - compatibility 1.0.0) /usr/lib/system/libremovefile.dylib
0x7fff8e695000 - 0x7fff8e6b5fff libsystem_kernel.dylib (1699.22.73 - compatibility 1.0.0) /usr/lib/system/libsystem_kernel.dylib
0x7fff8e9fe000 - 0x7fff8ea02fff libmathCommon.A.dylib (2026.0.0 - compatibility 1.0.0) /usr/lib/system/libmathCommon.A.dylib
0x7fff8fd3d000 - 0x7fff8fd3eff7 libsystem_blocks.dylib (53.0.0 - compatibility 1.0.0) /usr/lib/system/libsystem_blocks.dylib
0x7fff90063000 - 0x7fff9006afff libcopyfile.dylib (85.1.0 - compatibility 1.0.0) /usr/lib/system/libcopyfile.dylib
0x7fff90645000 - 0x7fff9064aff7 libsystem_network.dylib (??? - ???) /usr/lib/system/libsystem_network.dylib
0x7fff9064b000 - 0x7fff9064ffff libdyld.dylib (195.5.0 - compatibility 1.0.0) /usr/lib/system/libdyld.dylib
0x7fff90650000 - 0x7fff90651fff libunc.dylib (24.0.0 - compatibility 1.0.0) /usr/lib/system/libunc.dylib
0x7fff90c0b000 - 0x7fff90c14fff libnotify.dylib (80.0.0 - compatibility 1.0.0) /usr/lib/system/libnotify.dylib
0x7fff90c64000 - 0x7fff90c69fff libcompiler_rt.dylib (6.0.0 - compatibility 1.0.0) /usr/lib/system/libcompiler_rt.dylib
0x7fff913a3000 - 0x7fff913a9fff libmacho.dylib (800.0.0 - compatibility 1.0.0) /usr/lib/system/libmacho.dylib
0x7fff913d8000 - 0x7fff9144bfff libstdc++.6.dylib (52.0.0 - compatibility 7.0.0) /usr/lib/libstdc++.6.dylib

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 246323
thread_create: 0
thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=54.2M resident=18.8M(35%) swapped_out_or_unallocated=35.5M(65%)
Writable regions: Total=84.8M written=3496K(4%) resident=4620K(5%) swapped_out=0K(0%) unallocated=80.3M(95%)

REGION TYPE VIRTUAL
=========== =======
MALLOC 20.2M
MALLOC guard page 16K
MALLOC_LARGE (reserved) 256K reserved VM address space (unallocated)
STACK GUARD 8K
Stack 64.0M
__DATA 688K
__LINKEDIT 47.8M
__TEXT 6644K
shared memory 12K
=========== =======
TOTAL 139.4M
TOTAL, minus reserved VM space 139.1M


Related issues

Related to Ruby master - Bug #5076: Mac OS X Lion Support Closed03/14/2011Actions

Updated by sorah (Sorah Fukumori) almost 9 years ago

追記:

  • -O0では再現しないので-O3を指定しています
  • 新規ビルドディレクトリでビルドしています
  • Xcodeは4.1

Updated by kosaki (Motohiro KOSAKI) almost 9 years ago

さらに追記 gcc-4.2では再現しないので、gcc-llvm 固有の最適化問題のようですね

Updated by sorah (Sorah Fukumori) almost 9 years ago

さらにさらに追記

-O1 -O2では再現せず。-O1では一部テストが失敗しています。
1) Failure:
test_initialize_copy(TestEnumerator) [/Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb:68]:
Exception raised:
<#>.

2) Error:test_next_rewind(TestEnumerator):
SystemStackError: stack level too deep
/Users/sorah/git/ruby/ruby/test/ruby/test_enumerator.rb:125

現存するログでは-O2では再現してないと思いますが、ファイルに残すのを忘れてしまったため-O2でも再現しているかもしれません…

Updated by naruse (Yui NARUSE) almost 9 years ago

  • Parent task set to #5076

vm_insnhelper.c の vm_call_cfunc に volatile が足りないとかが理由だと思うんですが……。

Updated by kosaki (Motohiro KOSAKI) almost 9 years ago

以下のパッチで直るのを確認しましたが、理由が分からないので怖くてコミットできません。
誰かレビューしてもらえませんか?

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index c778214..a35dbb1 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -387,7 +387,7 @@ call_cfunc(VALUE (*func)(), VALUE recv,

static inline VALUE
vm_call_cfunc(rb_thread_t *th, volatile rb_control_frame_t *reg_cfp,

  • int num, VALUE recv, const rb_block_t *blockptr,
  • int num, volatile VALUE recv, const rb_block_t *blockptr, const rb_method_entry_t *me) { volatile VALUE val = 0;

Updated by naruse (Yui NARUSE) almost 9 years ago

遺憾ながら LLVM の最適化絡みは、ここに volatile 入れるとよくわからんが動くってのは既にやってるので、
コミットしてしまって良いと思います。
まぁ、volatile 入れてほのかに遅くなることはあっても挙動がおかしくなることはないと思うので。。

Updated by kosaki (Motohiro KOSAKI) almost 9 years ago

  • Category set to core
  • Status changed from Open to Closed
  • Assignee set to kosaki (Motohiro KOSAKI)
  • Target version set to 1.9.3

r32628 (for trunk)
r32629 (for 1.9.3)

としてコミットしました

Updated by kosaki (Motohiro KOSAKI) almost 9 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from kosaki (Motohiro KOSAKI) to yugui (Yuki Sonoda)
  • Target version changed from 1.9.3 to 1.9.2

あ、試してないけどたぶん1.9.2にバックポートしないとまずいと思います。
よってyuguiさんにアサインしなおします

#9

Updated by sorah (Sorah Fukumori) almost 9 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport192
  • Category changed from core to core
  • Target version deleted (1.9.2)
  • Parent task deleted (#5076)

Updated by mrkn (Kenta Murata) almost 9 years ago

ruby_1_9_2 の現在の HEAD (r32478) に r32528 をバックポートして、make test がすべてパスする事を確認しました。
また make test-all は #5081 で報告されている syslog のテストを除いて全てパスしました。

#11

Updated by naruse (Yui NARUSE) about 4 years ago

  • Status changed from Assigned to Rejected

Also available in: Atom PDF