Skip to content
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

Disconnect the room not properly called "Cleanup RTC" and "room.cleanUpParticipants". #583

Open
ChandruContus opened this issue Feb 9, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ChandruContus
Copy link

when I disconnect the room "cleanUpRTC()" " cleanUpParticipants(isFullReconnect: isFullReconnect)" frequently not called. So "track.stop() " not working and again join the room video and audio not rendered. But green dot show in top on status bar.

Livekit SDK Verision : 2.0.19

func cleanUp(withError disconnectError: Error? = nil,
isFullReconnect: Bool = false) async
{
log("withError: (String(describing: disconnectError)), isFullReconnect: (isFullReconnect)")

    // Reset completers
    _sidCompleter.reset()
    primaryTransportConnectedCompleter.reset()
    publisherTransportConnectedCompleter.reset()

    await signalClient.cleanUp(withError: disconnectError)

------------below function not called-----------

    await cleanUpRTC()
    await cleanUpParticipants(isFullReconnect: isFullReconnect)

    // Cleanup for E2EE
    if let e2eeManager {
        e2eeManager.cleanUp()
    }

    // Reset state
    _state.mutate {
        // if isFullReconnect, keep connection related states
        $0 = isFullReconnect ? State(
            connectOptions: $0.connectOptions,
            roomOptions: $0.roomOptions,
            url: $0.url,
            token: $0.token,
            nextReconnectMode: $0.nextReconnectMode,
            isReconnectingWithMode: $0.isReconnectingWithMode,
            connectionState: $0.connectionState
        ) : State(
            connectOptions: $0.connectOptions,
            roomOptions: $0.roomOptions,
            connectionState: .disconnected,
            disconnectError: LiveKitError.from(error: disconnectError)
        )
    }
}

}

Console log:

2025-02-09 20:09:53.225086+0530 SampleAppKit[1129:51643] [websocket] Read completed with an error Operation canceled
2025-02-09 20:09:53.248411+0530 SampleAppKit[1129:51645] [tcp] tcp_input [C5.1:3] flags=[R] seq=2381814154, ack=0, win=0 state=CLOSED rcv_nxt=2381814154, snd_una=1187171602

@ChandruContus ChandruContus added the bug Something isn't working label Feb 9, 2025
@hiroshihorie
Copy link
Member

It could be blocking at signalClient.cleanUp, I'll see if I can improve this.

@pblazej
Copy link
Contributor

pblazej commented Mar 13, 2025

@hiroshihorie do you think running cleanups concurrently is enough (or rather a workaround)? If there's a dependency, we should probably enforce that explicitly.

@hiroshihorie
Copy link
Member

After, checking the code I don't really see anything could block at SignalClient.cleanUp() so I wonder whats going on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants