Project

General

Profile

Actions

Bug #236

closed

Segfault when multiple threads

Added by radarek (Radosław Bułat) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-core:17669]

Description

=begin
$ ruby1.9 -v
ruby 1.9.0 (2008-07-09 revision 17963) [x86_64-linux]

$ uname -a
Linux ruby 2.6.24-19-generic #1 SMP Wed Jun 18 14:15:37 UTC 2008 x86_64 GNU/Linux

$queue = []

def produce
$queue << true if rand(10) < 5
end

loop do
produce
while client = $queue.shift do
Thread.new(client) do |c|
raise "bug" if c == false
end
puts Thread.list.size
end
end

when I run this program I get:

bug.rb:11: [BUG] Segmentation fault
ruby 1.9.0 (2008-07-09 revision 17963) [x86_64-linux]

-- control frame ----------
c:0003 p:0007 s:0007 b:0005 l:002308 d:000004 BLOCK bug.rb:11
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP

DBG> : "bug.rb:11:in `block (2 levels) in '"
-- backtrace of native function call (Use addr2line) --
0x7f0a4f40d5b1
0x7f0a4f34d239
0x7f0a4f34d393
0x7f0a4f3c849d
0x7f0a4f0f67d0
0x7f0a4f3fb936
0x7f0a4f3fb993
0x7f0a4f4025b3
0x7f0a4f4060bd
0x7f0a4f4085cb
0x7f0a4f411fbb
0x7f0a4f41204e
0x7f0a4f0ee3f7
0x7f0a4e597b2d

Aborted

Unfortunately addr2line doesn't produce useful info:

??:0
??:0
??:0
...
=end


Files

bug.rb (221 Bytes) bug.rb radarek (Radosław Bułat), 07/09/2008 03:36 AM
Actions

Also available in: Atom PDF

Like0
Like0