Fix service lifecycle issues: goroutine leaks, race conditions, and missing shutdown#84
Open
DerAndereAndi wants to merge 1 commit intodevfrom
Open
Fix service lifecycle issues: goroutine leaks, race conditions, and missing shutdown#84DerAndereAndi wants to merge 1 commit intodevfrom
DerAndereAndi wants to merge 1 commit intodevfrom
Conversation
Member
DerAndereAndi
commented
Apr 2, 2026
- Add DeviceLocal.Close() to atomically stop all goroutines and clean up state
- Fix HeartbeatManager: stop ticker on exit, protect stopHeartbeatC with mutex, wait for goroutine exit in StopHeartbeat using per-cycle done channel
- Fix CleanWriteApprovalCaches to stop pending timers before deleting map entries
- Fix ApproveOrDenyWrite TOCTOU by holding muxResponseCB across the entire operation, eliminating the double-response race window and removing muxWriteReceived
- Add nil-guard in write approval timer callback for cleaned-up state
- Clean up existing remote device in SetupRemoteDevice on reconnect (same SKI)
- Add events.drain() to wait for dispatched application event handlers
- Add comprehensive TDD test suite verifying all fixes
…issing shutdown - Add DeviceLocal.Close() to atomically stop all goroutines and clean up state - Fix HeartbeatManager: stop ticker on exit, protect stopHeartbeatC with mutex, wait for goroutine exit in StopHeartbeat using per-cycle done channel - Fix CleanWriteApprovalCaches to stop pending timers before deleting map entries - Fix ApproveOrDenyWrite TOCTOU by holding muxResponseCB across the entire operation, eliminating the double-response race window and removing muxWriteReceived - Add nil-guard in write approval timer callback for cleaned-up state - Clean up existing remote device in SetupRemoteDevice on reconnect (same SKI) - Add events.drain() to wait for dispatched application event handlers - Add comprehensive TDD test suite verifying all fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.