Skip to content

Fix service lifecycle issues: goroutine leaks, race conditions, and missing shutdown#84

Open
DerAndereAndi wants to merge 1 commit intodevfrom
feature/restart-improvements
Open

Fix service lifecycle issues: goroutine leaks, race conditions, and missing shutdown#84
DerAndereAndi wants to merge 1 commit intodevfrom
feature/restart-improvements

Conversation

@DerAndereAndi
Copy link
Copy Markdown
Member

  • 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
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 93.721% (+0.03%) from 93.691%
when pulling 6830c52 on feature/restart-improvements
into 65ec71e on dev.

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