Skip to content

[9.1](backport #46331) Fix Filebeat's race condition on shutdown#46397

Merged
belimawr merged 1 commit into9.1from
mergify/bp/9.1/pr-46331
Sep 5, 2025
Merged

[9.1](backport #46331) Fix Filebeat's race condition on shutdown#46397
belimawr merged 1 commit into9.1from
mergify/bp/9.1/pr-46331

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Sep 4, 2025

Note for reviewers

The detailed description of the issue this PR solves can be found at #45034 (comment)

Proposed commit message

When Filebeat fails to start because of a unknown input, it can get into a deadlock state and never exit. This commit attempts to fix it.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

## Disruptive User Impact
## Author's Checklist

How to test this PR locally

That's a non-deterministic problem, so testing is about running Filebeat over and over again and ensuring it never hangs during shutdown.

You can file the reproducing steps listed in the linked issue below, to run Filebeat over and over again, use the following script:

#!/bin/bash

# while "$@"; do :; done
counter=0
while true; do
    "$@"
    let counter++
    echo $counter
    true
done

Assuming the script is named rununtilfail and is ~/bin/rununtilfail , you can run:

~/bin/rununtilfail ./filebeat -c ./filebeat-test.yml -e

Let it run for a few minutes, if Filebeat never hangs, then it's very likely the issue has been solved.

On my tests, it usually took less than 100 runs for Filebeat to hang, in more extreme cases it would take a couple thousand tries for Filebeat to hang.

Related issues

## Use cases
## Screenshots
## Logs


This is an automatic backport of pull request #46331 done by Mergify.

When Filebeat fails to start because of a unknown input, it can get
into a deadlock state and never exit. This commit attempts to fix it.

(cherry picked from commit 3ee3201)
@mergify mergify bot added the backport label Sep 4, 2025
@mergify mergify bot requested a review from a team as a code owner September 4, 2025 21:43
@mergify mergify bot requested review from VihasMakwana and belimawr and removed request for a team September 4, 2025 21:43
@mergify mergify bot added the backport label Sep 4, 2025
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 4, 2025
@mergify mergify bot mentioned this pull request Sep 4, 2025
6 tasks
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 4, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions github-actions bot added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team bugfix labels Sep 4, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 4, 2025
@belimawr belimawr merged commit bdcdb5e into 9.1 Sep 5, 2025
51 of 54 checks passed
@belimawr belimawr deleted the mergify/bp/9.1/pr-46331 branch September 5, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bugfix Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants