When connecting to a livekit room, I sometimes ONL...
# ask-ai
g
When connecting to a livekit room, I sometimes ONLY see this log:
selected node for room
, upon which the connections fails with a PeerConnection Timeout. But, when I waited a little and tried again, I got the expected
starting RTC session
log after the
selected node for room
one, which is expected. Explain in the code with code pointers why we may or may not see the
starting RTC session
log:
Copy code
2025-09-03T18:47:52.308001034Z 2025-09-03T18:47:52.307Z    INFO    livekit    service/roomallocator.go:166    selected node for room    {"room": "room", "selectedNodeID": "ND_GfSccG8igzua"}                                                               │
│ 2025-09-03T18:48:55.569056427Z 2025-09-03T18:48:55.568Z    INFO    livekit    service/roomallocator.go:166    selected node for room    {"room": "room", "selectedNodeID": "ND_CVxSwq4zq6De"}                                                               │ 
│ 2025-09-03T18:48:55.573279799Z 2025-09-03T18:48:55.573Z    INFO    livekit    service/roommanager.go:394    starting RTC session    {"room": "room", "roomID": "RM_8wjANyUsqyZ3", "participant": "money-3", "pID": "PA_VorVa6NZFv6X", "remote": false, "roo │ 
│ m": "room", "nodeID": "ND_CVxSwq4zq6De", "numParticipants": 0, "participantInit": {"Identity": "money-3", "Reconnect": false, "ReconnectReason": "RR_UNKNOWN", "AutoSubscribe": true, "Client": {"sdk": "JS", "version": "1.3.0", "protocol": 8, "os": "Mac │ 
│  OS X", "osVersion": "10.15.7", "deviceModel": "Mac", "browser": "Chrome", "browserVersion": "139.0.0"}, "Grants": {"Identity": "", "Kind": "", "Video": {"RoomCreate": false, "RoomList": false, "RoomRecord": false, "RoomAdmin": false, "RoomJoin": true │ 
│ , "Room": "room", "CanPublish": "not-set", "CanSubscribe": "not-set", "CanPublishData": "not-set", "CanPublishSources": [], "CanUpdateOwnMetadata": "not-set", "IngressAdmin": false, "Hidden": false, "Recorder": false, "Agent": false, "CanSubscribeMetr │ 
│ ics": "not-set", "DestinationRoom": ""}, "SIP": {}, "RoomConfig": {}, "RoomPreset": ""}, "Region": "", "AdaptiveStream": true, "ID": "", "SubscriberAllowPause": "not-set", "DisableICELite": false, "CreateRoom": {"name": "room"}}}
t
Thanks for reaching out, Sohum. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you’re not seeing the
starting RTC session
log right after
selected node for room
, it usually means the participant’s connection ended or didn’t go through during the signaling phase, before the RTC session even got started. Here are a few reasons why this might happen, along with some helpful code pointers: • The
selected node for room
log pops up during the routing phase inside
StartParticipantSignal
, where the system figures out which RTC node to use for the participant. • Once the node is chosen, the system waits for the client to respond within a set timeout. If the client doesn’t respond—maybe due to network hiccups, client-side issues, or just a timeout—the connection closes, and it never reaches the
starting RTC session
step. • The
starting RTC session
log appears in the
StartSession
method of the
RoomManager
once a new participant is successfully set up and the session kicks off on the RTC node. To help you troubleshoot this, here are some friendly tips: 1. Double-check that the participant’s identity is correctly set in the
ParticipantInit
structure. 2. Look through the logs for any authentication errors or missing info during participant setup. 3. Take a peek at the network conditions to make sure the participant can respond quickly enough within the timeout period. 4. Make sure the routing is sending the participant to the right RTC node, and that the node itself is up and ready to handle new sessions. Following these steps should give you a clearer picture of why the
starting RTC session
log sometimes doesn’t show up. If you need a hand with any of this, just let me know—I’m here to help! Sources: pkg/service/rtcservice.go