Skip to content

fix: resolve agent hang on shutdown when stop signal sent during active scan#288

Merged
leoparente merged 2 commits intodevelopfrom
fix/OBS-2270-fix-otlp-shutdown-context
Mar 12, 2026
Merged

fix: resolve agent hang on shutdown when stop signal sent during active scan#288
leoparente merged 2 commits intodevelopfrom
fix/OBS-2270-fix-otlp-shutdown-context

Conversation

@leoparente
Copy link
Contributor

This pull request refactors the OTLP shutdown logic in the orbAgent and improves the logging behavior in the OTLP bridge server. The main focus is on simplifying the shutdown process by removing unnecessary context passing and ensuring consistent logging.

OTLP shutdown refactoring:

  • Changed the shutdownOTLP method in agent/agent.go to no longer require a context parameter, instead always using a background context with timeout. This simplifies shutdown calls and avoids potential nil context issues.
  • Updated all calls to shutdownOTLP in agent/agent.go to remove the context argument, ensuring consistency with the new method signature. [1] [2]

Logging improvements:

  • Moved the "OTLP bridge server started" log statement in agent/otlpbridge/server.go outside the gRPC serving goroutine, so it always logs when the server starts, regardless of serve errors.

…ve scan

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 12, 2026

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent 45.2% 6 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend 76.4% 48 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 66.5% 4 0 0
🟢 PASS 0.05s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 58.3% 4 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/opentelemetryinfinity 45.2% 2 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/pktvisor 66.5% 2 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/snmpdiscovery 58.3% 4 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/backend/worker 67.8% 7 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/config 100.0% 6 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/configmgr 49.5% 33 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/configmgr/fleet 64.4% 147 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/otlpbridge 50.2% 10 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/policies 98.9% 18 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/policymgr 71.6% 11 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/redact 81.6% 84 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/secretsmgr 47.1% 65 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/telemetry 81.7% 19 0 0
🟢 PASS (cached) github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 59.6%

@leoparente leoparente requested a review from jajeffries March 12, 2026 20:23
Copy link
Contributor

@jajeffries jajeffries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leoparente leoparente merged commit 2f073d8 into develop Mar 12, 2026
5 checks passed
@leoparente leoparente deleted the fix/OBS-2270-fix-otlp-shutdown-context branch March 12, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants