-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix lifecycle control #965
Conversation
I never rescue Exception (non StandardError) because we can do nothing for NoMemoryError, SystemStackError, SystemExit, and so on.
What did they raise? I guess they are doing something wrong. |
@sonots I did it mainly for SignalException, which can be raised from anywhere. And I also thought about kind of ScriptError (we can raise it by eval at anywhere in ruby). |
@tagomoris Then, I think we should rescue only SignalException and StandardError. |
@sonots If |
Do we rescue exit? If I write exit 0 on plugin (I never wite though), I expect that fluentd dies immediately without rescuing. |
Also, it looks root_agent.rb#L166 does not propagate error, so it recsues and ignores SystemExit. Ignoring SystemExit is not intuitive for me. |
Yes, that is what I will do. I think that we should not forgive plugins to exit. |
Someone may want to write exit just for developing purpose. Non standard, non-intuitive behavior brings troubles. |
I am very negative about rescuing entire Exception. It is practical manner in ruby world. Please read articles like
|
plugins should be sandbox so calling exit should not affect other plugin behaviour. |
If we go with |
Generally speaking, I say "Don't rescue Exception" if this is a Rails application. How many non-standard exceptions If we don't rescue Exception? Non-standard exceptions are:
|
@repeatedly okay, will do. |
I agree this. So, I think we do not need to take care of SystemExit. Rescuing SystemExit rather looks as forgiving plugins to call exit as a API design. |
I meant that "we should not forgive plugins to exit entire Fluentd process", not about just calling "exit" method. |
Okay, you meant that API supports (takes cares safely) plugins call exit method. If it is the design, rescuing SystemExit is okay. But, I also think we need to document as repeatedly says. |
I added a comment. |
…rrors to ensure shutdown correctly
* ServerEngine just send SIGTERM, but it was not handled appropriately * default signal handler raises SignalException with SIGTERM from `@default_loop.run` * and then, `shutdown` in ensure clause kicked (almost unexpectedly)
5a42a11
to
0133a4b
Compare
Merged. |
This change includes some changes and bug fixes about lifecycle of process and plugins.
super
instart
andshutdown
shutdown
was called inensure
clause, and it invokes shutdown sequence unexpectedlyThis change also includes removing
default_loop
from Engine. It wasn't used in anywhere, so I simplified main loop by removing it.