Skip to content

Conversation

@brian-mckinney
Copy link
Contributor

Proposed commit message

Fixes a panic in a unit test due to nil dereference

=== FAIL: x-pack/osquerybeat/beater TestOsquerybeatStatusReporting_Lifecycle (unknown)
--
  | panic: runtime error: invalid memory address or nil pointer dereference
  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe985c3]
  |  
  | goroutine 501 [running]:
  | github.com/elastic/elastic-agent-libs/monitoring.(*Registry).getOrCreateRegistry(0x0, {0xc000112930, 0x1, 0x1}, {0x0, 0x0, 0x0})
  | /opt/buildkite-agent/.asdf/installs/golang/1.24.9/packages/pkg/mod/github.com/elastic/[email protected]/monitoring/registry.go:157 +0x83
  | github.com/elastic/elastic-agent-libs/monitoring.(*Registry).GetOrCreateRegistry(0x0, {0x16c701a?, 0xc000100008?}, {0x0, 0x0, 0x0})
  | /opt/buildkite-agent/.asdf/installs/golang/1.24.9/packages/pkg/mod/github.com/elastic/[email protected]/monitoring/registry.go:149 +0x6a
  | github.com/elastic/beats/v7/x-pack/osquerybeat/beater.newOsquerydMetrics(0x184dab0?, 0xc000590078)
  | /opt/buildkite-agent/builds/bk-agent-prod-gcp-1762452447968064219/elastic/beats-xpack-osquerybeat/x-pack/osquerybeat/beater/osqueryd_metrics.go:65 +0x79
  | github.com/elastic/beats/v7/x-pack/osquerybeat/beater.(*osquerybeat).Run(0xc000488050, 0xc00048a1c0)
  | /opt/buildkite-agent/builds/bk-agent-prod-gcp-1762452447968064219/elastic/beats-xpack-osquerybeat/x-pack/osquerybeat/beater/osquerybeat.go:181 +0x3c5
  | github.com/elastic/beats/v7/x-pack/osquerybeat/beater.TestOsquerybeatStatusReporting_Lifecycle.func2()
  | /opt/buildkite-agent/builds/bk-agent-prod-gcp-1762452447968064219/elastic/beats-xpack-osquerybeat/x-pack/osquerybeat/beater/osquerybeat_status_test.go:113 +0x29
  | created by github.com/elastic/beats/v7/x-pack/osquerybeat/beater.TestOsquerybeatStatusReporting_Lifecycle in goroutine 500
  | /opt/buildkite-agent/builds/bk-agent-prod-gcp-1762452447968064219/elastic/beats-xpack-osquerybeat/x-pack/osquerybeat/beater/osquerybeat_status_test.go:112 +0x268

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

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@brian-mckinney brian-mckinney self-assigned this Nov 6, 2025
@brian-mckinney brian-mckinney requested a review from a team as a code owner November 6, 2025 19:05
@brian-mckinney brian-mckinney added bug Osquerybeat backport-skip Skip notification from the automated backport with mergify labels Nov 6, 2025
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 6, 2025
@botelastic
Copy link

botelastic bot commented Nov 6, 2025

This pull request doesn't have a Team:<team> label.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

🤖 GitHub comments

Just comment with:

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

@brian-mckinney brian-mckinney enabled auto-merge (squash) November 7, 2025 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Skip notification from the automated backport with mergify bug needs_team Indicates that the issue/PR needs a Team:* label Osquerybeat skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant