Skip to content

fix(media): skip Gst.DeviceMonitor.stop() on macOS to avoid segfault#1074

Closed
tfrere wants to merge 1 commit into
mobile-app-integration-lightfrom
light/fix-macos-gst-segfault
Closed

fix(media): skip Gst.DeviceMonitor.stop() on macOS to avoid segfault#1074
tfrere wants to merge 1 commit into
mobile-app-integration-lightfrom
light/fix-macos-gst-segfault

Conversation

@tfrere
Copy link
Copy Markdown
Contributor

@tfrere tfrere commented May 4, 2026

Summary

Stacked on top of #1069 (mobile-app-integration-light). Carve-out from the umbrella draft #1070.

On macOS 26 ("Tahoe"), calling Gst.DeviceMonitor.stop() can segfault inside gst_device_provider_stop -> avfdeviceprovider, which kills the whole Python daemon with SIGSEGV before any Python traceback can be emitted. The parent process only sees "exit code 1" with no clue.

The monitor is short-lived (one enumeration at boot per source type) so skipping the explicit stop on darwin is acceptable: the underlying providers are reclaimed when the Python object is garbage collected and when the process exits. Other platforms keep the original behavior, wrapped in a defensive try/except so an unexpected stop() failure logs instead of propagating.

Tested on macOS 14 (Sonoma) and macOS 26 (Tahoe) with the Reachy Mini daemon in USB mode.

Files

  • src/reachy_mini/media/device_detection.py (+18 / -1)

Notes

Test plan

  • Boot the daemon on macOS 26 (Tahoe), confirm it starts cleanly without SIGSEGV.
  • Boot on Linux, confirm the original stop() path is exercised and that any unexpected failure is logged but does not propagate.

Made with Cursor

On macOS 26 ("Tahoe"), calling Gst.DeviceMonitor.stop() can segfault
inside gst_device_provider_stop -> avfdeviceprovider, which kills the
whole Python daemon with SIGSEGV before any Python traceback can be
emitted. The parent process only sees "exit code 1" with no clue.

The monitor is short-lived (one enumeration at boot per source type)
so skipping the explicit stop on darwin is acceptable: the underlying
providers are reclaimed when the Python object is garbage collected
and when the process exits.

Other platforms keep the original behavior, wrapped in a defensive
try/except so an unexpected stop() failure logs instead of propagating.

Tested on macOS 14 (Sonoma) and macOS 26 (Tahoe) with the Reachy Mini
daemon in USB mode.

Made-with: Cursor
@tfrere tfrere closed this May 4, 2026
@tfrere tfrere deleted the light/fix-macos-gst-segfault branch May 4, 2026 12:33
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.

1 participant