Repository navigation
fix(tests): run FFI dispose test in a subprocess and add test timeouts - #931
Open
cloudwebrtc wants to merge 2 commits into
Open
cloudwebrtc wants to merge 2 commits into
cloudwebrtc wants to merge 2 commits into
Conversation
test_live_handles_marked_consumed_and_no_assert_after_dispose called FfiClient._dispose() inside the pytest process, which tears down the process-wide FFI runtime. Every later test that waits on an FFI callback then hangs forever; test_video.py (which only runs when LiveKit credentials are set) blocked every Test job until the 6h job limit. - Run the dispose test in a fresh interpreter, like the existing subprocess-exit test in the same file. - Add pytest-timeout (--timeout=300) and a 45 minute job timeout so a hang fails fast with a traceback instead of being cancelled after 6h.
cloudwebrtc
requested review from
changt,
lukasIO and
xianshijing-lk
as code owners
November 9, 2026 08:41
Contributor
|
👋 This PR has no changeset. If it should be released, add a markdown file under ---
"livekit-rtc": patch
---
Short description of the change, used in the release notes.
If this change doesn't need a release (docs, CI, tests), you can ignore this comment. |
lukasIO
approved these changes
Nov 9, 2026
…ay types On Windows ARM64, gc.get_objects() can return a weakref.proxy whose referent is already gone. isinstance(o, type) dereferences the proxy and raises ReferenceError. Check issubclass(type(o), type) instead, which reads the proxy's own type without dereferencing it.
This branch has not been deployed
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.
Problem
Since #857 (
bb3ed60), everybuild-rtc.ymlrun that has LiveKit credentials gets cancelled after the 6h job limit. All Test jobs on every platform stop aftertest_rpc_interceptors.py [99%]and never finishlivekit-rtc/tests/test_video.py. Runs from fork PRs show as green only because they have no secrets, sotest_video.pyis skipped.The cause is
test_live_handles_marked_consumed_and_no_assert_after_disposeintest_ffi_handle_lifecycle.py. It callsFfiClient.instance._dispose()inside the pytest process. That callslivekit_ffi_dispose(), which tears down the process-wide FFI runtime and leavesFfiClient._ffi_disposed = True. Every later test that waits on an FFI callback then blocks forever.test_video.pyis the next such test in collection order, and itsRoom.connect()has no timeout.Local reproduction: run the old lifecycle test file, then a test that awaits
AudioSource.capture_frame(). The second test never gets its FFI callback and times out. With this change, it passes.Changes
Move the dispose test into a fresh interpreter (
subprocess.run([sys.executable, "-c", ...])), the same way the existing subprocess-exit test in this file works. Its assertions are unchanged.tests.yml: installpytest-timeoutand run with--timeout=300. Settimeout-minutes: 45on the test job so a future hang fails quickly with a traceback instead of waiting for the 6h limit.test_dc.py::test_publish_data_makes_no_ctypes_array_type: replaceisinstance(o, type)withissubclass(type(o), type)when scanninggc.get_objects(). On Windows ARM64 the gc list can contain aweakref.proxywhose referent is gone.isinstance()dereferences it and raisesReferenceError: weakly-referenced object no longer exists.type(o)does not dereference the proxy, and ctypes array types are still matched.Not addressed here
test_ffi_client.pyreportedFin an earlier hung run. The job was killed before the error was printed, and it has not reproduced on this PR so far.