Skip to content

[9.4](backport #52005) [beatreceiver][packetbeat] Delegate shutdown_timeout logic to libbeat - #52266

Closed
mergify[bot] wants to merge 2 commits into
9.4from
mergify/bp/9.4/pr-52005
Closed

[9.4](backport #52005) [beatreceiver][packetbeat] Delegate shutdown_timeout logic to libbeat#52266
mergify[bot] wants to merge 2 commits into
9.4from
mergify/bp/9.4/pr-52005

Conversation

@mergify

@mergify mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Proposed commit message

This PR delegatesshutdown_timeout logic to libbeat. It stays consistent with how other beats also handle the same.

This is also required so that we do not wait for shutdown_timeout period every time the config is validated here

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.

Disruptive User Impact

None

Will also close #52031


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

…#52005)

* [beatreceiver] Delegate shutdown_timeout logic to libbeat

(cherry picked from commit 663f454)

# Conflicts:
#	packetbeat/beater/packetbeat.go
#	packetbeat/beater/processor.go
@mergify mergify Bot added the backport label Jul 27, 2026
@mergify
mergify Bot requested a review from a team as a code owner July 27, 2026 07:02
@mergify mergify Bot added the conflicts There is a conflict in the backported pull request label Jul 27, 2026
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 27, 2026
@mergify

mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of 663f454 has failed:

On branch mergify/bp/9.4/pr-52005
Your branch is up to date with 'origin/9.4'.

You are currently cherry-picking commit 663f45459.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   packetbeat/config/config.go
	modified:   packetbeat/tests/system/config/packetbeat.yml.j2
	modified:   packetbeat/tests/system/test_0060_flows.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   packetbeat/beater/packetbeat.go
	both modified:   packetbeat/beater/processor.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@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 Team:Security-Linux Platform Linux Platform Team in Security Solution skip-changelog labels Jul 27, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 27, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

@mergify

mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

This pull request has not been merged yet. Could you please review and merge it @khushijain21? 🙏

@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The Buildkite failure is caused by unresolved cherry-pick conflict markers in packetbeat/beater/packetbeat.go and packetbeat/beater/processor.go, not by a Packetbeat runtime or dependency failure. Resolve both conflicts and update the backport branch before rerunning CI.

Remediation

  • Resolve the conflict blocks in packetbeat/beater/packetbeat.go and packetbeat/beater/processor.go; remove all <<<<<<<, =======, and >>>>>>> markers while preserving the intended shutdown_timeout delegation and publish_timeout behavior.
  • Rerun make -C packetbeat check update, make check-no-changes, and pre-commit run --all-files.
Investigation details

Root Cause

The backport commit could not be cleanly applied. The PR diff still contains conflict markers at packetbeat/beater/packetbeat.go:100-111 and packetbeat/beater/processor.go:52-69. The processor.go conflict also combines the old shutdownTimeout implementation with the incoming publishTimeout implementation, so it requires a semantic resolution rather than simply deleting markers.

Evidence

  • Build: https://buildkite.com/elastic/beats/builds/50345
  • Job/steps: Packetbeat Run check/update and Run pre-commit
  • goimports failed with packetbeat/beater/packetbeat.go:100:1: expected statement, found '<<' and packetbeat/beater/processor.go:52:1: expected '}', found '<<'.
  • The pre-commit check-merge-conflict hook reported Merge conflict string '<<<<<<<' found in packetbeat/beater/processor.go:52 and packetbeat/beater/packetbeat.go:100, plus the corresponding ======= and >>>>>>> markers.
  • The PR already has the conflicts label and the earlier Mergify comment reports both files as unmerged paths.

Verification

The failure is directly confirmed by both independent CI steps; no additional tests were run because the source does not parse until the conflicts are resolved.


What is this? | From workflow: PR Buildkite Detective

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

Adapt #52005 to 9.4 by adding Beat.ShutdownTimeout for the beater
assignment and switching the processor flush wait to publish_timeout,
without pulling main-only logger changes.

Assisted-By: Composer
Co-authored-by: Cursor <cursoragent@cursor.com>
@khushijain21
khushijain21 requested a review from a team as a code owner July 27, 2026 09:34
@khushijain21

Copy link
Copy Markdown
Contributor

Resolved the cherry-pick conflicts and pushed.

9.4 adaptation: #51136 (libbeat drain watchdog / Beat.ShutdownTimeout) is not on 9.4, so this adds the Beat.ShutdownTimeout field for the beater assignment (forward-compatible). Processor flush wait uses publish_timeout so CheckConfig no longer blocks on shutdown_timeout. Kept existing status-reporter APIs; did not pull main-only logger changes from #51631.

Packetbeat beater/config compile cleanly locally.

@khushijain21
khushijain21 requested review from khushijain21 and leehinman and removed request for a team July 27, 2026 09:34
@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The golangci-lint step fails on Ubuntu, Windows, and macOS with the same four new Packetbeat findings: two forbidden logp.L calls, one WaitGroup modernization issue, and one deprecated b.Manager.Start call. Update the backport branch to address these findings, then rerun the lint workflow.

Remediation

  • Replace the diagnostic-hook and pipeline warning uses of global logp.L() in packetbeat/beater/packetbeat.go with the appropriate logger carried by b.Info.Logger.
  • Modernize packetbeat/beater/processor.go:81-83 to use WaitGroup.Go without a separate Add/Done pair.
  • Replace the deprecated b.Manager.Start() call in packetbeat/beater/packetbeat.go with the 9.4-supported PreInit/PostInit manager lifecycle, preserving the existing cleanup behavior.
  • Run the scoped Packetbeat lint/check commands and rerun this workflow.
Investigation details

Root Cause

The failure is a code-quality gate on the backport commit, not a runner or dependency failure. The same four findings are emitted by golangci-lint v2.12.2 on all three runners. The PR head contains the flagged patterns: global logging in Run, p.wg.Add(1) followed by p.wg.Go, and b.Manager.Start() in the managed run path.

Evidence

Validation

No tests were run; this was a read-only workflow-log investigation. The three platform jobs independently reported the same four findings.

Follow-up

After applying the changes, rerun the golangci-lint workflow and confirm all three platform jobs pass.


What is this? | From workflow: PR Actions Detective

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

@khushijain21

Copy link
Copy Markdown
Contributor

This PR requires backport of #51136. Which is not planned. Hence closing this PR

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

Labels

backport conflicts There is a conflict in the backported pull request skip-changelog Team:Security-Linux Platform Linux Platform Team in Security Solution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant