LiveKit C++ SDK Version
v1.4.0
Platform
Linux x86_64
OS Version
Ubuntu 26
Compiler & Version
g++ 15.2.0
CMake Version
4.2.3
How are you using the SDK?
Building from source (build.sh / build.cmd)
Issue Description
Calling Room::disconnect(DisconnectReason::ClientInitiated) while the network is down blocks the calling thread. When connectivity returns, internal rtc_engine attempts reconnect, fails with StateMismatch, and the process can crash.
shutdown function part:
void LiveKitService::shutdown() {
//...
qCInfo(LiveKitLog) << "_livekit_audio_source.reset()...";
_livekit_audio_source.reset();
qCInfo(LiveKitLog) << "_livekit_video_source.reset()...";
_livekit_video_source.reset();
qCInfo(LiveKitLog) << "_delegate.reset()...";
_delegate.reset();
if (_livekit_initialized.exchange(false)) {
qCInfo(LiveKitLog) << "_room.disconnect...";
_room.disconnect(DisconnectReason::ClientInitiated);
}
}
Steps to Reproduce
- Connect to a LiveKit room
- Disable network (or unplug)
- Call
_room.disconnect(DisconnectReason::ClientInitiated)
- Observe: thread blocks
- Re-enable network
- Disconnect unblocks, then reconnect errors appear; crash may follow
Logs
##Example LOGS
[2026-07-28 19:22:34.077][LiveKitLog][INFO][53865][livekit::LiveKitService::shutdown:165]: _room.disconnect...
[2026-07-28T17:22:49Z ERROR livekit_api::signal_client::signal_stream] unhandled websocket message Err(Io(Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }))
[2026-07-28T17:22:49Z ERROR livekit::rtc_engine] resuming connection failed: signal failure: server sent leave during reconnect: reason=StateMismatch, action=Reconnect
[2026-07-28T17:22:49Z ERROR livekit::rtc_engine] failed to reconnect to the livekit room
19:22:50: The command "..." terminated abnormally.
LiveKit C++ SDK Version
v1.4.0
Platform
Linux x86_64
OS Version
Ubuntu 26
Compiler & Version
g++ 15.2.0
CMake Version
4.2.3
How are you using the SDK?
Building from source (build.sh / build.cmd)
Issue Description
Calling
Room::disconnect(DisconnectReason::ClientInitiated)while the network is down blocks the calling thread. When connectivity returns, internalrtc_engineattempts reconnect, fails withStateMismatch, and the process can crash.shutdown function part:
void LiveKitService::shutdown() {
//...
qCInfo(LiveKitLog) << "_livekit_audio_source.reset()...";
_livekit_audio_source.reset();
qCInfo(LiveKitLog) << "_livekit_video_source.reset()...";
_livekit_video_source.reset();
qCInfo(LiveKitLog) << "_delegate.reset()...";
_delegate.reset();
if (_livekit_initialized.exchange(false)) {
qCInfo(LiveKitLog) << "_room.disconnect...";
_room.disconnect(DisconnectReason::ClientInitiated);
}
}
Steps to Reproduce
_room.disconnect(DisconnectReason::ClientInitiated)Logs