Skip to content

[9.3](backport #51940) Set shutdown timeout for beat receivers to 5s by default#51948

Open
mergify[bot] wants to merge 1 commit into
9.3from
mergify/bp/9.3/pr-51940
Open

[9.3](backport #51940) Set shutdown timeout for beat receivers to 5s by default#51948
mergify[bot] wants to merge 1 commit into
9.3from
mergify/bp/9.3/pr-51940

Conversation

@mergify

@mergify mergify Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Proposed commit message

Set shutdown timeout for beat receivers to 5s by default.

Beat receivers need a longer timeout than the default 1s, as it needs to exceed the batcher flush timeout. The current code gives the impression of this already happening, but in reality, if the beater handles pipeline shutdown on its own, the default timeout wins.

The PR adds the default in NewBeatForReceiver and adds a test for filebeat receiver which asserts that the timeout is at least 5 seconds.

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. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool.

Related issues


This is an automatic backport of pull request #51940 done by [Mergify](https://mergify.com).

Beat receivers need a longer timeout than the default 1s, as it needs to
exceed the batcher flush timeout. The current code gives the impression
of this already happening, but in reality, if the beater handles
pipeline shutdown on its own, the default timeout wins.

(cherry picked from commit 8f4bbab)
@mergify mergify Bot added the backport label Jul 14, 2026
@mergify mergify Bot requested a review from a team as a code owner July 14, 2026 22:26
@mergify mergify Bot requested review from AndersonQ and removed request for a team July 14, 2026 22:26
@mergify mergify Bot added the backport label Jul 14, 2026
@mergify mergify Bot requested a review from belimawr July 14, 2026 22:26
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /test : Run the Buildkite pipeline.

@github-actions github-actions Bot added bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team skip-changelog labels Jul 14, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 14, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

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

@swiatekm swiatekm enabled auto-merge (squash) July 14, 2026 22:29
@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The beats-xpack-filebeat check fails during go vet because the backport adds TestShutdownDrainTimeout but does not include the NewFactoryWithSettings helper it calls. This is a backport completeness issue, not a transient Buildkite failure.

Remediation

  • Backport the corresponding x-pack/filebeat/fbreceiver/factory.go change that defines NewFactoryWithSettings(Settings) and preserves NewFactory() as the no-argument wrapper, or adjust the test to construct the factory using the APIs available on 9.3.
  • Re-run make -C x-pack/filebeat check update followed by make check-no-changes.
Investigation details

Root Cause

The failed job runs make -C x-pack/filebeat check update and go vet reports x-pack/filebeat/fbreceiver/receiver_test.go:764:13: undefined: NewFactoryWithSettings. The PR diff adds TestShutdownDrainTimeout in x-pack/filebeat/fbreceiver/receiver_test.go, where line 764 calls NewFactoryWithSettings(Settings{Home: tmpDir}), but the same diff does not modify x-pack/filebeat/fbreceiver/factory.go. At the PR commit, that factory file exposes NewFactory() only; it has no NewFactoryWithSettings declaration. The test therefore cannot compile on the 9.3 backport branch.

The shutdown-timeout implementation in x-pack/libbeat/cmd/instance/beat.go is unrelated to this compile error; the failure occurs before tests execute.

Evidence

Verification

  • Not run beyond the recorded CI job: compilation stops in go vet before the new test can execute.

What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant