这是indexloc提供的服务,不要输入任何密码
Skip to content

Avoid a crash on reconnection when a track is disposed #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

jeankruger
Copy link
Contributor

A crash sometimes occurs during track republication, likely due to a race condition. Much like the connection state is also checked, let's simply trigger onPublishFailure and return false.

Crash Stack Trace:

java.lang.IllegalStateException: MediaStreamTrack has been disposed.
    at livekit.org.webrtc.MediaStreamTrack.checkMediaStreamTrackExists(MediaStreamTrack.java:0)
    at livekit.org.webrtc.MediaStreamTrack.checkMediaStreamTrackExists(MediaStreamTrack.java:120)
    at livekit.org.webrtc.MediaStreamTrack.id(MediaStreamTrack.java:0)
    at io.livekit.android.room.participant.LocalParticipant.publishTrackImpl(LocalParticipant.kt:612)
    at io.livekit.android.room.participant.LocalParticipant.publishAudioTrack(LocalParticipant.kt:445)
    at io.livekit.android.room.participant.LocalParticipant.republishTracks$_LiveKit_Kotlin_kt(LocalParticipant.kt:1515)
    at io.livekit.android.room.Room.onPostReconnect
    at io.livekit.android.room.RTCEngine$reconnect$job$1.invokeSuspend(RTCEngine.kt:608)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:0)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:0)
    at kotlinx.coroutines.CompletionStateKt.toState
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:0)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:0)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:0)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(Futures.java:113)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:0)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)

Copy link

changeset-bot bot commented Jun 4, 2025

🦋 Changeset detected

Latest commit: b281e40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
client-sdk-android Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@davidliu davidliu merged commit 9249cc1 into livekit:main Jun 10, 2025
2 checks passed
@davidliu davidliu mentioned this pull request Jun 10, 2025
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