DCell tries to setup regardless, so long as its required #51
Description
Hi,
So, firstly, I just released a SOA framework gem that is powered by dcell
https://github.com/jasonayre/cylons
If I could get a link in the readme that would be cool!
But anyways, Im having an issue was wondering if you could shed some light on, I believe it to be a bug but..
I noticed when running my apps that are using my gem, when DCell shouldn't be connecting to anything or doing anything, it still acts like it tried to connect, or is somehow launching threads, Im not sure. I thought it was a bug in my own code, because I was really sloppy with my requires in the main file,
https://github.com/jasonayre/cylons/blob/master/lib/cylons.rb
-- The problem is, if I include my gem in a rails app, and I run a rake task, or spec, or do anything where rails is loaded, even though the railtie is being skipped, when I exit the console or task finishes, it throws this error:
Terminating 4 actors...
Celluloid::SupervisionGroup crashed!
DCell::NotConfiguredError: please configure DCell with DCell.setup
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/dcell-0.15.0/lib/dcell.rb:76:in `id'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/dcell-0.15.0/lib/dcell/celluloid_ext.rb:56:in `address'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/celluloid-0.15.2/lib/celluloid/links.rb:22:in `delete'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/celluloid-0.15.2/lib/celluloid/actor.rb:354:in `handle_exit_event'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/celluloid-0.15.2/lib/celluloid/actor.rb:340:in `handle_system_event'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `task'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in `initialize'
/Users/jayre/.rvm/gems/jruby-1.7.4/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in `create'
SOMETIMES, it will throw that error I should say, but everytime without fail it says
Terminating 4 actors
As if it somehow trying to load dead supervision groups that don't even exist in the context of this application run? Im horribly confused as to what is happening, as it's not even connecting to ZK or anything.
Checkout https://github.com/jasonayre/cylons_demo
The admin app in particular, thats the one Ive been testing with. I commented out every require and all the code in my main module in the main cylons.rb file (and pointed to the local gem), and yet, it still does the same thing. Heres the thing, the railtie right now is responsible for creating the rpc service clients dynamically, from what is present in the zookeeper registry. So, theres no way for the app to know that any actors exist anywhere without there being a connection, which there cannot possibly be when all the code is commented out. I pushed a branch to demonstrate.
https://github.com/jasonayre/cylons/tree/dcell_bug_example
So ya if you pull down the cylons_demo + point the admin app to that branch, and load a console, you should see when you exit, either the big error, or the
Terminating 4 actors
It seems kind of random.
But ya, if you pull down gem and uncomment require 'dcell', youll see it won't happen.
Anyways, any idea what Im missing, or what could be happening?
P.S. great gem, hope you're planning on continuing development on it! :)