New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Celluloid::Supervisor.root ? #158
Comments
This is a question better posed on the mailing list than opening an issue. Celluloid::Supervisor.root is used primarily internally by Celluloid::SupervisionGroup.run (or subclass thereof) to hold on top the toplevel supervisor. Future versions of Celluloid will start a toplevel supervisor automatically, so I do not suggest trying to set Celluloid::Supervisor.root yourself. It's also used by the shutdown code, which starts at Celluloid::Supervisor.root then walks the supervision tree recursively until it reaches the terminal supervisors, which are shut down one-at-a-time. This behavior is not fully finalized but will be prior to Celluloid 1.0. |
Thanks. Well it is an issue with documentation :) There could at least be a little more written here http://rubydoc.info/gems/celluloid/Celluloid/Supervisor#root-class_method Thanks for the explanation. Can you please enlighten me how you would implement graceful shutdown if you have workers which are running tasks about 5 seconds long, and upon receiving an INT/TERM these tasks must finish before the application can shutdown? I've tried a few things, but nothing feels right. E.g. trapping the signals myself won't work well, because Celluloid seems to be trapping them too and I obviously can't use the supervision root... |
Graceful shutdown is a difficult and, at present, poorly solved problem. I'd like to completely rewrite the existing supervisor system with more tests and make a closer study of how both Erlang and Akka handle shutdown. |
I see. I think with only the supervisor root being set by Celluloid at least some temporary solution can be made (since it receives terminate before actors are terminated, it can wait for actors to finish), until this rewrite happens. |
I started a discussion about this at https://groups.google.com/d/msg/celluloid-ruby/Rd2AurcPNpo/xejk2OT3zwEJ |
This is available (and I like that), but why does it never seem to be set by Celluloid? I can set it manually, but it seems weird to me that it's not set by Celluloid and I can't find any meaningful documentation on this.
For example there is no mention what this object is supposed to be, the only thing I can see from the code is that it must respond to a terminate method. So why isn't it simply before_terminate or something then? This root name seems kinda ambiguous and unclear to me. I can see from the code what it's used for but I can't predict what plans you have for it and what I can put in it safely.
To me something like Celluloid.before_terminate would make a lot more sense. This root looks like something that used to be used for something but never got deprecated after the thing using it got removed.
The text was updated successfully, but these errors were encountered: