Projects

Ticket #816 (closed defect: fixed)

Opened 19 months ago

Last modified 19 months ago

Assertion fails on multi-threaded code

Reported by: mootoh@… Owned by: lsansonetti@…
Priority: minor Milestone: MacRuby 0.7
Component: MacRuby Keywords:
Cc:

Description

I tried the following simple multi-threaded code snippet on MacRuby 0.6 (release build, obtained from  http://www.macruby.org/downloads.html, universal-darwin10.0, x86_64), and it aborted with following assertion:

Assertion failed: ((b->flags & flags) == flags), function rb_vm_prepare_block, file dispatcher.cpp, line 1773.

Code snippet to reproduce this issue:

N=2
M=1000000

def compute_intensive n
   r = 0
   M.times do |i|
      M.times do |j|
         r = i * j + n
      end
   end
   r
end

threads = []

N.times do |i|
   th = Thread.new do
      compute_intensive i
   end
   threads.push th
end

threads.each { |thread| thread.join }

I tried both ruby 1.8.7 (2009-06-12 patchlevel 174) and ruby 1.9.2dev (2009-08-30 trunk 24718), and those produced no error.

Change History

follow-up: ↓ 2   Changed 19 months ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.7

I tried the snippet on trunk and it seems to work well. The program uses 170% of my mac book pro CPU which seems correct too. However, it takes quite a lot of time. Could you retry with trunk too and let us know if you find any trouble? (You can download a nightly build here:  http://www.macruby.org/files/nightlies/). Thanks!

in reply to: ↑ 1   Changed 19 months ago by mootoh@…

I tried it with the latest nightly build and found it works fine. Thank you for such a rapid answer.

Note: See TracTickets for help on using tickets.