Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

DCell tries to setup regardless, so long as its required #51

Open
jasonayre opened this issue Oct 15, 2013 · 11 comments
Open

DCell tries to setup regardless, so long as its required #51

jasonayre opened this issue Oct 15, 2013 · 11 comments

Comments

@jasonayre
Copy link

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! :)

@jasonayre
Copy link
Author

Oh also I tried it in non jruby as well, did same thing with 2.0.0

@tarcieri
Copy link
Member

It looks like you're trying to use DCell's facilities before it's initialized. I don't know what else to say but you can't do that? You need to move any code that uses DCell itself to run after DCell has been initialized.

@jasonayre
Copy link
Author

That error is occuring as soon as I require DCell. I commented out everything except require dcell, and thats enough to cause the error.

@tarcieri
Copy link
Member

Strange, that shouldn't happen. I'll have to take a more in-depth look

@jasonayre
Copy link
Author

More info, created new rails app, added DCell, bundle, couldnt reproduce error. I noticed dcell was locked at older version, so I did bundle update, installed a bunch of dependencies, and updated celluloid to 15.2 -- tried it again, error popped back up.

So it happened somewhere on version update, it installed a bunch of new dependencies as well, reel, http_parser, celluloid-io, which i didnt see before. guessing it could be somewhere in there. ill play around with it more when i get home, here is an example of the bug in a brand new rails app, in this instance Im not actually even requiring dcell anywhere.

https://github.com/jasonayre/dcell_bug_example

bundle exec rails c
exit

Bug should appear

@jasonayre
Copy link
Author

It seems to be an issue with reel, i pulled out the explorer stuff entirely and its fixed. I feel strongly that stuff should exist on its own in a separate codebase or gem anyways. Ill put up a pulll request.

@halorgium
Copy link
Contributor

There is a known issue which I have not fixed where reel needs celluloid/autostart.
This library and reel are a little behind celluloid master and haven't had enough love recently.

@tarcieri
Copy link
Member

@halorgium I just got bitten by Reel requiring celluloid/autostart earlier today. Would be great to fix that.

@tarcieri
Copy link
Member

@halorgium while I assure you Reel has received quite a bit of love recently, that's a different metric than the overall maturity of the project.

Perhaps we could better set expectations by explicitly noting the maturity of each project in the README

@halorgium
Copy link
Contributor

@tarcieri yer, I meant perhaps my attention to the project with regard to the larger changes which celluloid is going.
There is a general question about how libraries should depend on celluloid compared to end-user applications.

@niamster
Copy link
Contributor

@jasonayre do you still have original issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants