[Bug:1.8] Thread.new { Queue.new.pop }; fork


#1

ruby 1.8 e$B$G!"0J2<$N$h$&$K$9$k$He(B (fork e$B$G$G$-$?;R%W%m%;%9$,e(B)
SEGV e$B$7$^$9!#e(B

% ./ruby -rthread -e ‘Thread.new { Queue.new.pop }; fork’
-e:1: [BUG] Segmentation fault
ruby 1.8.8dev (2009-03-14 revision 22939) [i686-linux]

% gdb ruby
GNU gdb 6.4.90-debian
Copyright © 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for
details.
This GDB was configured as “i486-linux-gnu”…Using host libthread_db
library “/lib/tls/i686/cmov/libthread_db.so.1”.

(gdb) run -rthread -e ‘Thread.new { Queue.new.pop }; fork’
Starting program: /home/akr/ruby/18/ruby/ruby -rthread -e ‘Thread.new {
Queue.new.pop }; fork’
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread -1210022208 (LWP 19153)]

Program exited normally.
(gdb) -e:1: [BUG] Segmentation fault
ruby 1.8.8dev (2009-03-14 revision 22939) [i686-linux]

(gdb) set follow-fork-mode child
(gdb) run -rthread -e ‘Thread.new { Queue.new.pop }; fork’
Starting program: /home/akr/ruby/18/ruby/ruby -rthread -e ‘Thread.new {
Queue.new.pop }; fork’
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread -1209936192 (LWP 19159)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to process 19160]
0x080bac64 in st_lookup (table=0x8142900, key=2889, value=0xbfe764b8) at
st.c:250
250 hash_val = do_hash(key, table);
(gdb) bt
#0 0x080bac64 in st_lookup (table=0x8142900, key=2889,
value=0xbfe764b8) at st.c:250
#1 0x080cd775 in classname (klass=3084954180) at variable.c:151
#2 0x080cd879 in rb_class_path (klass=3084954180) at variable.c:192
#3 0x080cd9c1 in rb_class2name (klass=3084954180) at variable.c:303
#4 0x08054d78 in rb_thread_check (data=135538944) at eval.c:10657
#5 0x080661a1 in rb_thread_kill (thread=3084951660) at eval.c:11864
#6 0xb7fcf7da in kill_waiting_threads (waiting=)
at thread.c:276
#7 0xb7fcf82f in free_queue (queue=0x81451e8) at thread.c:841
#8 0x080716f6 in run_final (obj=3084951540) at gc.c:1964
#9 0x0807182a in finalize_list (p=0xb7e09ff4) at gc.c:1110
#10 0x0805a5b4 in ruby_finalize_1 () at eval.c:1601
#11 0x0806b782 in ruby_cleanup (ex=0) at eval.c:1641
#12 0x0806b8c1 in ruby_stop (ex=0) at eval.c:1699
#13 0x0806ba31 in ruby_run () at eval.c:1720
#14 0x080536bf in main (argc=Cannot access memory at address 0x2
) at main.c:48
(gdb)