Hi team, my team was using the cloud version livek...
# cloud
a
Hi team, my team was using the cloud version livekit. But we meet some problmes: Why are there two sessions with the same room_no? Both RM_ZPmseQ4m6jRi and RM_MnnKjt42S8Cp share the room_no: SALES_PITCH_f0c33205-045b-40c3-b798-85853678a439. First, in RM_ZPmseQ4m6jRi, participant e262d1d3-717d-44f6-8adb-7b01e404b4a3 left at 090133 (1756371693). After that, two participants attempted to join the room: • Participant 9b86c3e2-5771-441a-8b39-01732c32ce05 joined at 090157 (1756371717) and was assigned to session RM_ZPmseQ4m6jRi • Participant 158f329d-6e9a-419a-97eb-c949e38b10f8 joined at 090144 (1756371704) and was assigned to session RM_MnnKjt42S8Cp This resulted in two active sessions with the same room_no, meaning two participants joined the same room but the system dispatched them to different sessions. Questions: 1. Why were the two participants assigned to different sessions instead of the same one? 2. Can I reuse the same room_no for different meetings scheduled at different times? 3. How can I check whether a room has completely ended (i.e., the session has totally ended)?
r
Rooms can have different sessions. The participants were not in the room at the same time participant
e262d1d3-717d-44f6-8adb...
left before
158f329d-6e9a-419a-97eb
joined. How are you creating the "room name"? Looks like it was reused for both participants.
Also looks like something maybe wrong with your webhook receiver sometimes:
failed to send webhook
a
so, if the webhook returned an error, the livekit will not close the session?
r
why do you think that? The webhook should have nothing to do with the session. Just noting I am seeing your server did not accept the webhook incase you did not know.
a
I created the room by create token with room config parameters. And I will reuse a same room name in some scenario.
Sorry, the webhook is working correctly. I received all the events from both sessions. However, I'm curious: why did participant 9b86c3e2-5771-441a-8b39-01732c32ce05 join the old session?
I think the session has closed, because I received the room finished event
r
Yes, the webhooks got delivered after retransmit.
However, I'm curious: why did participant 9b86c3e2-5771-441a-8b39-01732c32ce05 join the old session?
A session may get "used" if it has not been idle for too long.
Basically if a room name has a "fresh" session that session will be used otherwise a new session will be create for that room name.
a
So at that time, LiveKit didn't choose the "fresh" session, but instead selected the session that hadn't been idle for too long. How long is the "idle" timeout period?
r
no, and I am not sure
If it picks an existing session it is "fresh" šŸ™‚ If there is not a session it will create one.
a
Actually, there are two sessions existing for the same room name in my scenario. I think this might be a bug or something is wrong.
r
what do you mean?
I looked at that room/sessions and it looked good to me
What issue do you have?
a
Room_name: SALES_PITCH_f0c33205-045b-40c3-b798-85853678a439 • Participant 9b86c3e2-5771-441a-8b39-01732c32ce05 joined at 090157 (1756371717) and was assigned to session RM_ZPmseQ4m6jRi • Participant 158f329d-6e9a-419a-97eb-c949e38b10f8 joined at 090144 (1756371704) and was assigned to session RM_MnnKjt42S8Cp RM_ZPmseQ4m6jRi and RM_MnnKjt42S8Cp both are fresh in that time
r
what do you mean? What issue are you having?
a
Is this behavior expected? Should one room name be able to have two concurrent sessions?
r
A room name can have multiple session ids through time.
The situation you are encountering with two sessions sharing the same
room_name
can be attributed to how LiveKit handles room sessions. When a room is created, it can have multiple sessions based on the timing of participant joins and leaves. Here are the key points to understand: see here for more guidence. 1. Session Management: When a participant leaves a room, the session may not immediately close if there are still active participants or if the system has not yet marked the session as closed. If a new participant attempts to join shortly after, they may be assigned to a different session if the previous session is still considered active or "fresh" by the system. 2. Room Name Reuse: Reusing the same room name for different meetings can lead to confusion. If you create a room with the same name shortly after another session has ended, there is a risk that the new session may not be recognized as distinct, especially if the previous session has not fully closed in the system's view. It is recommended to use unique room names (e.g., appending a timestamp or unique identifier) to avoid this issue 3. Idle Timeout: The "idle" timeout period, which determines how long a session can remain inactive before it is considered closed, is not explicitly documented. However, it is important to note that if a session has been recently active, it may still be considered valid for new participants joining 4. Checking Room Status: To determine if a room has completely ended, you can monitor the webhook events for a "room finished" event. This indicates that the session has fully closed and is no longer active. In summary, to avoid having multiple sessions with the same
room_no
, consider using unique room names for each meeting and ensure that sessions are fully closed before reusing a room name. Notes:* • The behavior you are experiencing is not a bug but rather a consequence of how LiveKit manages room sessions and their states. • If you continue to experience issues, it may be beneficial to review your implementation of room creation and session management to ensure it aligns with best practices.
šŸ™ 1
šŸ‘ 1
a
Got it. I'll use unique room names to avoid this scenario.
r
Good idea
a
I encountered this situation. As you can see, participant 158f329d-6e9a-419a-97eb-c949e38b10f8 has not left session RM_MnnKjt42S8Cp. As expected, participant 9b86c3e2-5771-441a-8b39-01732c32ce05 should have joined RM_MnnKjt42S8Cp. Instead, participant 9b86c3e2-5771-441a-8b39-01732c32ce05 joined RM_ZPmseQ4m6jRi. As a result, they cannot see each other in the room. Therefore, this situation may occur under certain circumstances.
r
When I looked before
158f32...
left 11 seconds before
9b86c3...
joined the room
a
I'll re-examine this issue and run more tests to verify the behavior.
r
āœ… 1