-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 memqueue getting stuck on shutdown #37077
Merged
belimawr
merged 1 commit into
elastic:main
from
belimawr:fix-queue-deadlock-on-shutdown
Nov 13, 2023
Merged
Fix memqueue getting stuck on shutdown #37077
belimawr
merged 1 commit into
elastic:main
from
belimawr:fix-queue-deadlock-on-shutdown
Nov 13, 2023
Conversation
This file contains 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
botelastic
bot
added
the
needs_team
Indicates that the issue/PR needs a Team:* label
label
Nov 9, 2023
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Collaborator
belimawr
force-pushed
the
fix-queue-deadlock-on-shutdown
branch
from
November 10, 2023 12:24
abcc42e
to
34dba90
Compare
There was a case when openState.publish could get stuck and ignore its shutdown signal, effectively preventing a Filebeat (or any Beat) from gracefully terminating. This commit fixes this by ensuring every channel read/write also checks for the shutdown signal.
belimawr
force-pushed
the
fix-queue-deadlock-on-shutdown
branch
from
November 10, 2023 14:50
34dba90
to
fef001f
Compare
belimawr
added
the
Team:Elastic-Agent-Data-Plane
Label for the Agent Data Plane team
label
Nov 10, 2023
botelastic
bot
removed
the
needs_team
Indicates that the issue/PR needs a Team:* label
label
Nov 10, 2023
faec
approved these changes
Nov 10, 2023
mergify bot
pushed a commit
that referenced
this pull request
Nov 13, 2023
There was a case when openState.publish could get stuck and ignore its shutdown signal, effectively preventing a Filebeat (or any Beat) from gracefully terminating. This commit fixes this by ensuring every channel read/write also checks for the shutdown signal. (cherry picked from commit a473880)
belimawr
added a commit
that referenced
this pull request
Nov 16, 2023
There was a case when openState.publish could get stuck and ignore its shutdown signal, effectively preventing a Filebeat (or any Beat) from gracefully terminating. This commit fixes this by ensuring every channel read/write also checks for the shutdown signal. (cherry picked from commit a473880) --------- Co-authored-by: Tiago Queiroz <[email protected]>
Scholar-Li
pushed a commit
to Scholar-Li/beats
that referenced
this pull request
Feb 5, 2024
There was a case when openState.publish could get stuck and ignore its shutdown signal, effectively preventing a Filebeat (or any Beat) from gracefully terminating. This commit fixes this by ensuring every channel read/write also checks for the shutdown signal.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport-v8.11.0
Automated backport with mergify
Team:Elastic-Agent-Data-Plane
Label for the Agent Data Plane team
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.
Proposed commit message
There was a case when openState.publish could get stuck and ignore its shutdown signal, effectively preventing a Beat (confirmed with Filebeat) from gracefully terminating.
This commit fixes this by ensuring every channel read/write also checks for the shutdown signal.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.## Author's ChecklistHow to test this PR locally
Create a server that will reply with logs. I used my fork from flog
Build/install and run with
flog -t http -f json
, this will start an HTTP server on:3000
Build Filebeat from the
x-pack
folderUse the following
filebeat.yml
filebeat.yml
Do NOT deploy an Elasticsearch, you want the output blocked and the queue full!
Start filebeat, it will log to
stdout
Wait until no more events are published and the only logs are metrics and reconnection attempts
Hit
CTRL+C
or send aSIGTERM
to FilebeatIt should gracefully shutdown within a few seconds.
Even though the issue is within the queue implementation, some inputs will eventually shutdown (like filestream) even if the Publish call got stuck, the httpjson input will stay blocked for ever.
Related issues
## Use cases## Screenshots## Logs