Issue #4866 has been reported by Motohiro KOSAKI.

----------------------------------------
Bug #4866: Macでmake checkするとIO.copy_streamでSEGV
http://redmine.ruby-lang.org/issues/4866

Author: Motohiro KOSAKI
Status: Assigned
Priority: Normal
Assignee: Akira Tanaka
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-06-10 trunk 31985) [x86_64-darwin10.7.4] 


make checkが以下のように異常終了します。


.
#245 test_io.rb:99:in `block in <top (required)>': 
       at_exit { p :foo }
   
       megacontent = "abc" * 12345678
       #File.open("megasrc", "w") {|f| f << megacontent }
   
       Thread.new { sleep rand*0.2; Process.kill(:INT, $$) }
   
       r1, w1 = IO.pipe
       r2, w2 = IO.pipe
       t1 = Thread.new { w1 << megacontent; w1.close }
       t2 = Thread.new { r2.read; r2.close }
       IO.copy_stream(r1, w2) rescue nil
       w2.close
       r1.close
       t1.join
       t2.join
       #=> killed by SIGABRT (signal 6)
| bootstraptest.tmp.rb:13: [BUG] Segmentation fault
| ruby 1.9.3dev (2011-06-10 trunk 31985) [x86_64-darwin10.7.4]
| 
| -- Control frame information -----------------------------------------------
| c:0004 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC  :copy_stream
| c:0003 p:0145 s:0014 b:0013 l:002188 d:000b40 EVAL   bootstraptest.tmp.rb:13
| c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
| c:0001 p:0000 s:0002 b:0002 l:002188 d:002188 TOP   
| 
| -- Ruby level backtrace information ----------------------------------------
| bootstraptest.tmp.rb:13:in `<main>'
| bootstraptest.tmp.rb:13:in `copy_stream'
| 
| -- See Crash Report log file under ~/Library/Logs/CrashReporter or ---------
| -- /Library/Logs/CrashReporter, for the more detail of ---------------------
| -- C level backtrace information -------------------------------------------
| 
| -- Other runtime information -----------------------------------------------
| 
| * Loaded script: bootstraptest.tmp.rb
| 
| * Loaded features:
| 
|     0 enumerator.so
|     1 /Users/kosaki/ruby/.ext/x86_64-darwin10.7.4/enc/encdb.bundle
|     2 /Users/kosaki/ruby/.ext/x86_64-darwin10.7.4/enc/trans/transdb.bundle
|     3 /Users/kosaki/ruby/lib/rubygems/defaults.rb
|     4 /Users/kosaki/ruby/lib/tsort.rb
|     5 /Users/kosaki/ruby/lib/rubygems/deprecate.rb
|     6 /Users/kosaki/ruby/lib/rubygems/dependency_list.rb
|     7 /Users/kosaki/ruby/lib/rubygems/path_support.rb
|     8 /Users/kosaki/ruby/rbconfig.rb
|     9 /Users/kosaki/ruby/lib/rubygems/exceptions.rb
|    10 /Users/kosaki/ruby/lib/rubygems/custom_require.rb
|    11 /Users/kosaki/ruby/lib/rubygems/version.rb
|    12 /Users/kosaki/ruby/lib/rubygems/requirement.rb
|    13 /Users/kosaki/ruby/lib/rubygems/platform.rb
|    14 /Users/kosaki/ruby/lib/rubygems/specification.rb
|    15 /Users/kosaki/ruby/lib/rubygems.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
| 
  megacontent-copy_stream
FAIL 1/925 tests failed
make: *** [yes-btest-ruby] Error 1
[1]    95841 exit 2     make check OPTS="-v" TESTS="-v -q -j8 "


Process:         ruby-193 [96102]
Path:            /Users/kosaki/ruby/ruby-193
Identifier:      ruby-193
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  ruby-193 [95844]

Date/Time:       2011-06-10 23:24:40.171 +0900
OS Version:      Mac OS X 10.6.7 (10J4138)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000079656e860
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib             	0x00007fff885225d6 __kill + 10
1   libSystem.B.dylib             	0x00007fff885c2cde abort + 83
2   ruby-193                      	0x0000000100038262 rb_bug_errno + 0
3   ruby-193                      	0x00000001000fc442 signal_exec + 0
4   libSystem.B.dylib             	0x00007fff8853466a _sigtramp + 26
5   ruby-193                      	0x00000001000fc510 rb_signal_exec + 51
6   ruby-193                      	0x000000010018556f rb_threadptr_execute_interrupts_rec + 211
7   ruby-193                      	0x0000000100185706 rb_thread_execute_interrupts + 26
8   ruby-193                      	0x000000010006d4e7 exec_interrupts + 29
9   ruby-193                      	0x00000001001853d3 rb_thread_call_with_gvl + 162
10  ruby-193                      	0x000000010006d548 maygvl_copy_stream_continue_p + 90
11  ruby-193                      	0x000000010006dc6a maygvl_copy_stream_read + 134
12  ruby-193                      	0x000000010006dfb7 nogvl_copy_stream_read_write + 443
13  ruby-193                      	0x000000010006e069 nogvl_copy_stream_func + 47
14  ruby-193                      	0x000000010018519b rb_thread_blocking_region + 216
15  ruby-193                      	0x000000010006e919 copy_stream_body + 1457
16  ruby-193                      	0x000000010003e487 rb_ensure + 151
17  ruby-193                      	0x000000010006eb5d rb_io_s_copy_stream + 378
18  ruby-193                      	0x00000001001754a0 call_cfunc + 282
19  ruby-193                      	0x0000000100175307 vm_call_cfunc + 284
20  ruby-193                      	0x00000001001744d0 vm_call_method + 373
21  ruby-193                      	0x000000010016f032 vm_exec_core + 11449
22  ruby-193                      	0x000000010017ee0a vm_exec + 147
23  ruby-193                      	0x000000010017f7dd rb_iseq_eval_main + 45
24  ruby-193                      	0x000000010003d0cb ruby_exec_internal + 193
25  ruby-193                      	0x000000010003d1ef ruby_exec_node + 30
26  ruby-193                      	0x000000010003d1c2 ruby_run_node + 56
27  ruby-193                      	0x0000000100000d23 main + 79 (main.c:40)
28  ruby-193                      	0x0000000100000ccc start + 52

Thread 1:
0   libSystem.B.dylib             	0x00007fff8850ef8a __semwait_signal + 10
1   libSystem.B.dylib             	0x00007fff88512da1 _pthread_cond_wait + 1286
2   ruby-193                      	0x0000000100182af6 native_cond_timedwait + 37
3   ruby-193                      	0x00000001001834a5 thread_timer + 121
4   libSystem.B.dylib             	0x00007fff8850d4f6 _pthread_start + 331
5   libSystem.B.dylib             	0x00007fff8850d3a9 thread_start + 13

Thread 2:
0   libSystem.B.dylib             	0x00007fff8850ef8a __semwait_signal + 10
1   libSystem.B.dylib             	0x00007fff88512da1 _pthread_cond_wait + 1286
2   ruby-193                      	0x0000000100182af6 native_cond_timedwait + 37
3   ruby-193                      	0x00000001001831b5 native_sleep + 270
4   ruby-193                      	0x0000000100184b9d sleep_timeval + 129
5   ruby-193                      	0x0000000100184d31 sleep_for_polling + 44
6   ruby-193                      	0x0000000100184db2 rb_thread_polling + 78
7   ruby-193                      	0x00000001000fc061 rb_f_kill + 703
8   ruby-193                      	0x00000001001754a0 call_cfunc + 282
9   ruby-193                      	0x0000000100175307 vm_call_cfunc + 284
10  ruby-193                      	0x00000001001744d0 vm_call_method + 373
11  ruby-193                      	0x000000010016f032 vm_exec_core + 11449
12  ruby-193                      	0x000000010017ee0a vm_exec + 147
13  ruby-193                      	0x000000010017d922 invoke_block_from_c + 584
14  ruby-193                      	0x000000010017daa8 rb_vm_invoke_proc + 253
15  ruby-193                      	0x0000000100183da8 thread_start_func_2 + 512
16  ruby-193                      	0x0000000100182ec5 thread_start_func_1 + 51
17  libSystem.B.dylib             	0x00007fff8850d4f6 _pthread_start + 331
18  libSystem.B.dylib             	0x00007fff8850d3a9 thread_start + 13

Thread 3:
0   libSystem.B.dylib             	0x00007fff8850ef8a __semwait_signal + 10
1   libSystem.B.dylib             	0x00007fff88512da1 _pthread_cond_wait + 1286
2   ruby-193                      	0x0000000100182ab7 native_cond_wait + 29
3   ruby-193                      	0x0000000100182772 gvl_acquire + 90
4   ruby-193                      	0x000000010018505b blocking_region_end + 33
5   ruby-193                      	0x00000001001852be rb_thread_io_blocking_region + 207
6   ruby-193                      	0x000000010005d017 rb_write_internal + 60
7   ruby-193                      	0x000000010005d941 io_binwrite + 852
8   ruby-193                      	0x000000010005dd41 io_fwrite + 158
9   ruby-193                      	0x000000010005de8f io_write + 247
10  ruby-193                      	0x000000010005df31 io_write_m + 34
11  ruby-193                      	0x00000001001754d7 call_cfunc + 337
12  ruby-193                      	0x000000010017895f vm_call0 + 685
13  ruby-193                      	0x0000000100179d9d rb_call0 + 171
14  ruby-193                      	0x0000000100179cf0 rb_call + 59
15  ruby-193                      	0x0000000100179fbd rb_funcall + 534
16  ruby-193                      	0x000000010005df61 rb_io_write + 46
17  ruby-193                      	0x000000010005df80 rb_io_addstr + 29
18  ruby-193                      	0x00000001001754d7 call_cfunc + 337
19  ruby-193                      	0x0000000100175307 vm_call_cfunc + 284
20  ruby-193                      	0x00000001001744d0 vm_call_method + 373
21  ruby-193                      	0x000000010017232e vm_exec_core + 24501
22  ruby-193                      	0x000000010017ee0a vm_exec + 147
23  ruby-193                      	0x000000010017d922 invoke_block_from_c + 584
24  ruby-193                      	0x000000010017daa8 rb_vm_invoke_proc + 253
25  ruby-193                      	0x0000000100183da8 thread_start_func_2 + 512
26  ruby-193                      	0x0000000100182ec5 thread_start_func_1 + 51
27  libSystem.B.dylib             	0x00007fff8850d4f6 _pthread_start + 331
28  libSystem.B.dylib             	0x00007fff8850d3a9 thread_start + 13

Thread 4:
0   libSystem.B.dylib             	0x00007fff8850ef8a __semwait_signal + 10
1   libSystem.B.dylib             	0x00007fff88512da1 _pthread_cond_wait + 1286
2   ruby-193                      	0x0000000100182ab7 native_cond_wait + 29
3   ruby-193                      	0x0000000100182772 gvl_acquire + 90
4   ruby-193                      	0x000000010018505b blocking_region_end + 33
5   ruby-193                      	0x00000001001852be rb_thread_io_blocking_region + 207
6   ruby-193                      	0x000000010005cfd9 rb_read_internal + 60
7   ruby-193                      	0x000000010005ec76 io_bufread + 79
8   ruby-193                      	0x000000010005edfb io_fread + 160
9   ruby-193                      	0x000000010005f941 read_all + 335
10  ruby-193                      	0x00000001000600fe io_read + 128
11  ruby-193                      	0x00000001001754a0 call_cfunc + 282
12  ruby-193                      	0x0000000100175307 vm_call_cfunc + 284
13  ruby-193                      	0x00000001001744d0 vm_call_method + 373
14  ruby-193                      	0x000000010016f032 vm_exec_core + 11449
15  ruby-193                      	0x000000010017ee0a vm_exec + 147
16  ruby-193                      	0x000000010017d922 invoke_block_from_c + 584
17  ruby-193                      	0x000000010017daa8 rb_vm_invoke_proc + 253
18  ruby-193                      	0x0000000100183da8 thread_start_func_2 + 512
19  ruby-193                      	0x0000000100182ec5 thread_start_func_1 + 51
20  libSystem.B.dylib             	0x00007fff8850d4f6 _pthread_start + 331
21  libSystem.B.dylib             	0x00007fff8850d3a9 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x000000000000000d  rcx: 0x000000010035c948  rdx: 0x0000000000000000
  rdi: 0x0000000000017766  rsi: 0x0000000000000006  rbp: 0x000000010035c960  rsp: 0x000000010035c948
   r8: 0x00007fff70f2da40   r9: 0x0000000000000000  r10: 0x00007fff8851e616  r11: 0xffffff80002e4730
  r12: 0x0000000000000000  r13: 0x0000000000000000  r14: 0x000000010180c888  r15: 0x00000001005ffef8
  rip: 0x00007fff885225d6  rfl: 0x0000000000000202  cr2: 0x000000010035afd8

Binary Images:
       0x100000000 -        0x100225fe7 +ruby-193 ??? (???) <BA0E4C3C-659E-DB67-DA3E-1542905CC024> /Users/kosaki/ruby/ruby-193
       0x100362000 -        0x100363fff +encdb.bundle ??? (???) <08C7BB02-5372-D150-369E-F387ED7B6378> /Users/kosaki/ruby/.ext/x86_64-darwin10.7.4/enc/encdb.bundle
       0x100366000 -        0x100367fff +transdb.bundle ??? (???) <1944083B-D771-2816-565E-AB9FBA03556B> /Users/kosaki/ruby/.ext/x86_64-darwin10.7.4/enc/trans/transdb.bundle
    0x7fff5fc00000 -     0x7fff5fc3bdef  dyld 132.1 (???) <DB8B8AB0-0C97-B51C-BE8B-B79895735A33> /usr/lib/dyld
    0x7fff805a7000 -     0x7fff8065dfff  libobjc.A.dylib 227.0.0 (compatibility 1.0.0) <1960E662-D35C-5D98-EB16-D43166AE6A22> /usr/lib/libobjc.A.dylib
    0x7fff862ec000 -     0x7fff862f0ff7  libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
    0x7fff86677000 -     0x7fff866f4fef  libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <35ECA411-2C08-FD7D-11B1-1B7A04921A5C> /usr/lib/libstdc++.6.dylib
    0x7fff884d3000 -     0x7fff88694fff  libSystem.B.dylib 125.2.10 (compatibility 1.0.0) <C80582B8-D8F7-A378-E27D-28411EE53901> /usr/lib/libSystem.B.dylib
    0x7fff88789000 -     0x7fff887d5fff  libauto.dylib ??? (???) <328CCF97-091D-C529-E576-C78583445711> /usr/lib/libauto.dylib
    0x7fffffe00000 -     0x7fffffe01fff  libSystem.B.dylib ??? (???) <C80582B8-D8F7-A378-E27D-28411EE53901> /usr/lib/libSystem.B.dylib

 


-- 
http://redmine.ruby-lang.org