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

**URL:** <https://www.ruby-forum.com/t/bug-1-8-thread-new-queue-new-pop-fork/162817>\
**Category:** Development\
**Created:** [March 14, 2009, 2:25am UTC](https://www.ruby-forum.com/t/bug-1-8-thread-new-queue-new-pop-fork/162817 "2009-03-14T02:25:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [March 14, 2009, 2:25am UTC](https://www.ruby-forum.com/t/bug-1-8-thread-new-queue-new-pop-fork/162817/1 "2009-03-14T02:25:55Z")

</div>

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)
