Skip to content

Terminate every universe even if one fails, and don't panic in Drop - #86

Open
stewartadam wants to merge 1 commit into
mainfrom
claude/project-thread-0t11p6-4-terminate-all
Open

stewartadam wants to merge 1 commit into
mainfrom
claude/project-thread-0t11p6-4-terminate-all

Conversation

@stewartadam

@stewartadam stewartadam commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • SacnSourceInternal::terminate used ? inside its loop, so the first failed termination send stopped it. The remaining universes never got their termination packets and stayed registered. This is the path Drop for SacnSource uses.
  • Drop for SacnSource called thread.join().unwrap(). If the update thread had panicked, that panicked inside drop, which aborts the process if it happens while already unwinding.
  • The update thread itself panicked on a poisoned mutex (trd_src.lock().unwrap()).

Fix

  • terminate tries every universe and deregisters each one, even when its sends fail. It returns the first error after all of them have been attempted.
  • Drop ignores the join result.
  • The update thread exits its loop when the mutex is poisoned, instead of panicking.

Test

Added a unit test in source.rs that swaps the source's socket for a Unix domain socket so every send fails. It checks that terminate returns an error, leaves no universes registered, and marks the source as not running. On main it fails with all three universes still registered. Unix-only, because it relies on Domain::UNIX.

cargo test --lib and tests/src_tests.rs pass.

terminate() returned on the first send error, leaving the remaining
universes without termination packets and still registered. It now tries
every universe, deregisters each one, and returns the first error.

Drop called thread.join().unwrap(), which panics (and aborts the process
if already unwinding) when the update thread panicked. The update thread
itself panicked on a poisoned mutex; it now exits instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KzaQVPkrkczgX2g7wGkip5
@stewartadam stewartadam self-assigned this Nov 12, 2026
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