[MacRuby] #1339: macruby crashes when initialize() with optional arg called from File.open block
#1339: macruby crashes when initialize() with optional arg called from File.open block -------------------------------+-------------------------------------------- Reporter: bigwood@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.11 Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- the following script will always crash. 0) TTT.initialize() must have an optional argument (past the first argument) 1) TTT.new() has to be called from a File.open() block #!/usr/local/bin/macruby -w # see http://www.macruby.org/documentation/gcd.html class Array def parallel_map(&block) result = [] # Creating a group to synchronize block execution. group = Dispatch::Group.new # We will access the `result` array from within this serial queue, # as without a GIL we cannot assume array access to be thread-safe. result_queue = Dispatch::Queue.new('access-queue.#{result.object_id}') 0.upto(size - 1) do |idx| # Dispatch a task to the default concurrent queue. Dispatch::Queue.concurrent.async(group) do #temp = block.call(self[idx]) temp = block[self[idx]] # same #temp = block === self[idx] # same #puts "sending #{idx}: #{self[idx]} with #{block.class}\n" result_queue.async(group) { result[idx] = temp } end end # Wait for all the blocks to finish. group.wait result end end class TTT #def initialize(string) def initialize(string, dup = false) end end source = $0 (1..2).to_a.parallel_map do |idx| #puts idx File.open(source) do |file| #Dir.chdir("/tmp") do TTT.new("") end end -- Ticket URL: <http://www.macruby.org/trac/ticket/1339> MacRuby <http://macruby.org/>
#1339: macruby crashes when initialize() with optional arg called from File.open block -------------------------------+-------------------------------------------- Reporter: bigwood@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- Changes (by watson1978@…): * milestone: MacRuby 0.11 => Old description:
the following script will always crash. 0) TTT.initialize() must have an optional argument (past the first argument) 1) TTT.new() has to be called from a File.open() block
#!/usr/local/bin/macruby -w
# see http://www.macruby.org/documentation/gcd.html class Array def parallel_map(&block) result = [] # Creating a group to synchronize block execution. group = Dispatch::Group.new # We will access the `result` array from within this serial queue, # as without a GIL we cannot assume array access to be thread-safe. result_queue = Dispatch::Queue.new('access- queue.#{result.object_id}') 0.upto(size - 1) do |idx| # Dispatch a task to the default concurrent queue. Dispatch::Queue.concurrent.async(group) do #temp = block.call(self[idx]) temp = block[self[idx]] # same #temp = block === self[idx] # same #puts "sending #{idx}: #{self[idx]} with #{block.class}\n" result_queue.async(group) { result[idx] = temp } end end # Wait for all the blocks to finish. group.wait result end end
class TTT #def initialize(string) def initialize(string, dup = false) end end
source = $0 (1..2).to_a.parallel_map do |idx| #puts idx File.open(source) do |file| #Dir.chdir("/tmp") do TTT.new("") end end
New description: the following script will always crash.[[BR]] 0) TTT.initialize() must have an optional argument (past the first argument)[[BR]] 1) TTT.new() has to be called from a File.open() block {{{ #!ruby #!/usr/local/bin/macruby -w # see http://www.macruby.org/documentation/gcd.html class Array def parallel_map(&block) result = [] # Creating a group to synchronize block execution. group = Dispatch::Group.new # We will access the `result` array from within this serial queue, # as without a GIL we cannot assume array access to be thread-safe. result_queue = Dispatch::Queue.new('access-queue.#{result.object_id}') 0.upto(size - 1) do |idx| # Dispatch a task to the default concurrent queue. Dispatch::Queue.concurrent.async(group) do #temp = block.call(self[idx]) temp = block[self[idx]] # same #temp = block === self[idx] # same #puts "sending #{idx}: #{self[idx]} with #{block.class}\n" result_queue.async(group) { result[idx] = temp } end end # Wait for all the blocks to finish. group.wait result end end class TTT #def initialize(string) def initialize(string, dup = false) end end source = $0 (1..2).to_a.parallel_map do |idx| #puts idx File.open(source) do |file| #Dir.chdir("/tmp") do TTT.new("") end end }}} -- -- Ticket URL: <http://www.macruby.org/trac/ticket/1339#comment:1> MacRuby <http://macruby.org/>
#1339: macruby crashes when initialize() with optional arg called from File.open block -------------------------------+-------------------------------------------- Reporter: bigwood@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- Comment(by watson1978@…): hmm, in my environment, this issue does not reproduce :( -- Ticket URL: <http://www.macruby.org/trac/ticket/1339#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby