Ensure do_close failures don't halt pipeline shutdown#19035
Merged
Conversation
Route plugin do_close calls in register_plugins rollback and shutdown_workers through close_plugin_and_ignore so one plugin raising doesn't leave remaining filters/outputs unclosed. Also fix the log key to use the instance-level config_name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
This pull request does not have a backport label. Could you fix it @andrewvc? 🙏
|
andrewvc
commented
Apr 21, 2026
| @logger.warn( | ||
| "plugin raised exception while closing, ignoring", | ||
| exception_logging_keys(e, :plugin => plugin.class.config_name)) | ||
| exception_logging_keys(e, :plugin => plugin.config_name)) |
Contributor
Author
There was a problem hiding this comment.
Delegators prevented the previous code from working for filters / outputs. Now we prefer the instance form.
Filter context: unrelated safe_pipeline_worker_count warn during start_workers tripped the strict expect().to receive(:warn).with(...) expectation. Add allow(logger).to receive(:warn) as a pass-through. Output context: pipeline.outputs.first on CI resolves to dummyoutputmore, not dummyoutput — output ordering isn't guaranteed to match config text order. Assert against raising_output.config_name so the match tracks the plugin actually stubbed to raise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
💚 Build Succeeded
History
cc @andrewvc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the shutdown code to make sure all resources are released through
#do_closeeven if one fails. I caught this while reviewing logstash-plugins/logstash-input-beats#537Release notes
Fix the situation where if during pipeline shutdown a filter or output plugin failed to shut down resources may not be released.
What does this PR do?
Ensures resources are released on pipeline shutdown even when exceptions are raised in
#closeWhy is it important/What is the impact to the user?
Without this we may leak resources
Checklist
Author's Checklist
How to test this PR locally
What to look for in the output:
A WARN line: plugin raised exception while closing, ignoring with :plugin=>"boom_close" and the boom from do_close exception in the keys.
The pipeline exits cleanly — the stdout output still closes, process terminates without hanging.
Example WARN line + subsequent output: