larrytheliquid / dataflow

Dataflow concurrency for Ruby (inspired by the Oz language)
MIT License
124 stars 12 forks source link

Ruby 1.9.2 ? #1

Open openhood opened 14 years ago

openhood commented 14 years ago

Hello,

I'm trying to run dataflow on ruby-1.9.2-head but run into issues:

ruby-1.9.2-head > require "dataflow"
~/.rvm/gems/ruby-1.9.2-head/gems/dataflow-0.3.1/dataflow.rb:63: warning: undefining `object_id' may cause serious problems
 => true 
ruby-1.9.2-head > include Dataflow
 => Object 
ruby-1.9.2-head > 
ruby-1.9.2-head >   Ping = Actor.new {
ruby-1.9.2-head >       3.times {
ruby-1.9.2-head >           case receive
ruby-1.9.2-head ?>          when "Ping"
ruby-1.9.2-head ?>            puts "Ping"
ruby-1.9.2-head ?>            Pong.send "Pong"
ruby-1.9.2-head ?>          end
ruby-1.9.2-head ?>      }
ruby-1.9.2-head ?>  }
 => #<Dataflow::Actor:0x000001019623d0 run> 
ruby-1.9.2-head > 
ruby-1.9.2-head >   Pong = Actor.new {
ruby-1.9.2-head >       3.times {
ruby-1.9.2-head >           case receive
ruby-1.9.2-head ?>          when "Pong"
ruby-1.9.2-head ?>            puts "Pong"
ruby-1.9.2-head ?>            Ping.send "Ping"
ruby-1.9.2-head ?>          end
ruby-1.9.2-head ?>      }
ruby-1.9.2-head ?>  }
 => #<Dataflow::Actor:0x0000010193f5d8 run> 
ruby-1.9.2-head > 
ruby-1.9.2-head >   Actor.new { Ping.send "Ping" }
 => #<Dataflow::Actor:0x000001019382d8 run> 
ruby-1.9.2-head > 
ruby-1.9.2-head >   Ping.join
fatal: deadlock detected
    from (irb):27:in `join'
    from (irb):27
    from ~/.rvm/rubies/ruby-1.9.2-head/bin/irb:17:in `<main>'
ruby-1.9.2-head > Pong.join

As you see, first I got a warning on require, then Ping.join complain about some deadlock, the last instruction never ends. Is it even supposed to work on ruby 1.9.x or is dataflow meant for jruby only?

larrytheliquid commented 14 years ago

The warning is intentional. I haven't run the specs against 1.9.* lately. I'll take a look at this later today and report what I find.

Thanks for creating an issue for this!

openhood commented 14 years ago

Dataflow would probably benefit a lot from using Fibers if available. I don't understand why dataflow isn't much more popular among rubyist, I think it's a terrific piece of code. Together with the http://github.com/headius/ruby-atomic it's a great combo, pretty much solves all the hard things related to threads in an innovative yet easy to use way.

larrytheliquid commented 14 years ago

Thanks, I haven't seen that project from headius, I'll take a look.

FYI, I did experiment with Fibers in dataflow on an old branch: http://github.com/larrytheliquid/dataflow/blob/fibers/spec/dataflow_spec.rb

larrytheliquid commented 14 years ago

Didn't get to this yesterday, but just confirmed the same error on 1.9 trunk. Hopefully I'll have some time tonight to debug why this is happening.