Skip to content

Proposed fix for tokio runtime missing when called from Unity .NET GC#1016

Open
MaxHeimbrock wants to merge 3 commits intomainfrom
max/fix-tokio-runtime-crashing-unity
Open

Proposed fix for tokio runtime missing when called from Unity .NET GC#1016
MaxHeimbrock wants to merge 3 commits intomainfrom
max/fix-tokio-runtime-crashing-unity

Conversation

@MaxHeimbrock
Copy link
Copy Markdown
Contributor

@MaxHeimbrock MaxHeimbrock commented Apr 15, 2026

First commit introduces a new test that repros the crash I see in Unity and tests fails:
https://github.com/livekit/rust-sdks/actions/runs/24567408053
With second commit the bug is fixed and tests are green again, as seen in pipeline now.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Changeset

The following package versions will be affected by this PR:

Package Bump
livekit patch
livekit-ffi patch

@MaxHeimbrock MaxHeimbrock reopened this Apr 17, 2026
@MaxHeimbrock MaxHeimbrock force-pushed the max/fix-tokio-runtime-crashing-unity branch from 8d72c50 to f6a2122 Compare April 17, 2026 13:24
@MaxHeimbrock MaxHeimbrock marked this pull request as ready for review April 17, 2026 13:51
MaxHeimbrock and others added 2 commits April 17, 2026 15:56
Reproduces the crash seen in the Unity SDK when a StreamWriter's
FfiHandle is released by the .NET GC finalizer thread (CLT-2773).
The finalizer thread has no Tokio runtime in TLS, so the unconditional
tokio::spawn in RawStream::drop panics with "there is no reactor running".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock force-pushed the max/fix-tokio-runtime-crashing-unity branch from 23f4fe7 to 03e5992 Compare April 17, 2026 13:57
@xianshijing-lk
Copy link
Copy Markdown
Contributor

lgtm

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