-
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
stop inputs upon a worker error before terminating the pipeline #12307
stop inputs upon a worker error before terminating the pipeline #12307
Conversation
I figured the problem: this is specifically when using a single worker (or if all workers die); if that single worker dies then if the input is in a IMO there are two solutions to this:
Solution 2 seems better since it gives a chance for remaining workers to drain the queue and IIF there are no workers left we drop the event each input plugin was trying to push. |
Chose solution 2. |
@colinsurprenant I've tried with |
@andsel you can point any plugin to a local copy by editing
and then re-bundling with
and then you can inject a I have a few dummy plugins around for doing such tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally with bad behaving filter, and it's fixed.
LGTM
801d85b
to
f7bb971
Compare
Since last LGTM I added specs and exposed the |
For the record, the added specs were first created against master to make sure they were not passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't count the cause of this issue as a regression, but rather an incomplete fix. Prior to the referenced code-change a crashing worker always crashed the whole Logstash process, and after it only sometimes caused its pipeline to crash.
That said, the code changes here look good to me, and catch the new edge-case. Thank you for following up with specs.
@yaauie agreed on incomplete fix vs regression; I rephrased the description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This addresses an incomplete fix in elastic#12019 starting in 7.8.1 where upon catching a worker exception (to avoid crashing the whole logstash per elastic#12306) the input plugin(s) are not terminated prior to closing the pipeline leading to the input plugin(s) continuing execution and failing with IllegalStateException & Tried to write to a closed queue since closing the pipeline also correctly closes the queue.
95f7d84
to
79554c2
Compare
merged in master and backported for 7.9.3, 7.10.0, 7.11.0. |
What does this PR do?
This addresses an incomplete fix in #12019 starting in 7.8.1 where upon catching a worker exception (to avoid crashing the whole logstash per #12306) the input plugin(s) are not terminated prior to closing the pipeline leading to the input plugin(s) continuing execution and failing with
IllegalStateException
&Tried to write to a closed queue
since closing the pipeline also correctly closes the queue.Why is it important/What is the impact to the user?
This is a critical bug affecting users if logstash experiences a worker error.
Checklist
Queue.push
does not return upon closing the inputHow to test this PR locally
To reproduce the problem prior to this PR:
IllegalStateException
&Tried to write to a closed queue
errors will be produced, with this PR, the original exception is reported and the pipeline is correctly terminated.Related issues