Skip to content

fix: prevent Zoom SDK shutdown segfaults - #981

Open
solaoi wants to merge 1 commit into
mainfrom
kaoyama/fix-zoom-sdk-shutdown
Open

fix: prevent Zoom SDK shutdown segfaults#981
solaoi wants to merge 1 commit into
mainfrom
kaoyama/fix-zoom-sdk-shutdown

Conversation

@solaoi

@solaoi solaoi commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • stop the Redis listener, GLib timers, and media subscriptions before tearing down Zoom SDK services
  • explicitly unsubscribe and destroy Zoom renderers before calling CleanUPSDK()
  • avoid unsafe Python/nanobind finalization after a native Zoom bot process completes normally
  • preserve normal interpreter finalization for processes that did not load the Zoom Meeting SDK

Problem

A native Zoom bot process can complete its work successfully and then fail during Python interpreter shutdown. Zoom SDK service, callback, raw-data helper, or renderer wrappers may remain alive after CleanUPSDK(), causing nanobind finalization to segfault.

This change releases SDK-owned resources in dependency order. The run_bot command also flushes logging and standard streams before exiting the dedicated bot process without running the unsafe finalization path. This only happens after run_bot.run() returns normally and only when zoom_meeting_sdk was loaded; exceptions still propagate normally.

There are no API or user-facing behavior changes.

Testing

  • python manage.py test bots.tests.test_zoom_bot.TestZoomSDKShutdown --verbosity 2
  • python manage.py test bots.tests.test_zoom_bot.TestZoomBot.test_bot_can_wait_for_host_then_join_meeting bots.tests.test_zoom_bot.TestZoomBot.test_bot_can_join_meeting_and_record_audio_and_video --keepdb
  • ruff check on all changed Python files
  • ruff format --check on all changed Python files

The shutdown regression test starts the real zoom-meeting-sdk in a child process, obtains a raw-data helper, calls CleanUPSDK(), and verifies that the bot command exits successfully. A companion test verifies that non-Zoom bot commands still use normal interpreter finalization.

@solaoi
solaoi requested a review from a team as a code owner August 26, 2026 16:07
@solaoi solaoi assigned solaoi and unassigned solaoi Aug 26, 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.

1 participant