-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
pipeline shutdown OOB plugins stop #3895
Conversation
pushing commits related to |
@colinsurprenant @jsvd Added jordansissel/ruby-stud#23 to track work on making |
why not get rid of Sometimes they are one in the same. for example, in the |
In some plugins stop will not make run abort right away (maybe stop? will On Thu, Sep 17, 2015, 20:27 Tal Levy notifications@github.com wrote:
|
@jsvd Is there a reason output plugins don't have |
@jsvd, do you know what is up with this? https://github.com/elastic/logstash/blob/feature/oob_plugins_stop/lib/logstash/pipeline.rb#L103-L106
I think we should clean that up for this PR. not sure what it is referencing. |
Agreed, looking at that comment we can actually reduce the method to: def wait_inputs
@input_threads.each(&:join)
end |
221700c
to
0be3994
Compare
@andrewvc eventually both filters and outputs might also have |
678ce76
to
140a456
Compare
LGTM; didn't run the tests, though. |
WRT to the new instead I suggest we do something like def do_close
# do whatever should be done prior to call the real plugin defined close
close if respond_to? :close
end same idea with |
140a456
to
bd31623
Compare
Currently, during shutdown, the pipeline loops through input workers and calls Thread.raise on each input thread. Plugins rescue that exception to exit the `run` loop. Afterwards, `teardown` is called for any additional bookkeeping. This proposal exposes a `stop` call on the input plugin class to alert an input that it should shutdown. It is the plugin job to frequently poll an internal `stop?` method to know if it's time to exit and terminate if so. The `teardown` method remains to do the additional bookkeeping, and it will be called by the inputworker when `run` terminates. add concurrent-ruby as logstash-core dependency make Plugins::Input#stop? public In some scenarios it's necessary for the inputworker or the pipeline to know that the plugin is in a shutdown mode document why inputworker sleeps on StandardError better debug message when input plugin raises exception during shutdown
cleanup @filter_to_output initialization remove @run_mutex, use ready? to synchonize shutdown agains startup sequence remove ShutdownSignal handling & cleanup
remove edge case when running from rubinius add do_stop and do_close to avoid using super
bd31623
to
112b281
Compare
This is a PR reboot of #3812 from a shared branch to facilitate collaboration.
Original description by @jsvd :
Currently, during shutdown, the pipeline loops through input workers
and calls Thread.raise on each input thread. Plugins rescue that
exception to exit the
run
loop. Afterwards,teardown
is called forany additional bookkeeping.
This proposal exposes a
stop
call on the input plugin class to alertan input that it should shutdown. It is the plugin job to frequently
poll an internal
stop?
method to know if it's time to exit andterminate if so.
The
teardown
method remains to do the additional bookkeeping, and itwill be called by the inputworker when
run
terminates.resolves #3210 and replaces #3211