Skip to content

remote_access: Always run Room::close to completion - #1453

Open
gasmith wants to merge 4 commits into
mainfrom
gasmith/db-1714-lk-room-close
Open

remote_access: Always run Room::close to completion#1453
gasmith wants to merge 4 commits into
mainfrom
gasmith/db-1714-lk-room-close

Conversation

@gasmith

@gasmith gasmith commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Changelog

  • Fixed an issue where a gateway may stay connected to a room
    indefinitely after the last viewer has disconnected.

Docs

None

Links

Fixes: DB-1714

Description

LiveKit has an upstream bug where Room::close can hang indefinitely.
For that reason, the SDK has a timeout. However, when the timeout is
reached, we drop the Room. That's the wrong thing to do, because the
Room doesn't impl Drop, and so we end up leaking our connection, and
staying in the room forever.

This change runs Room::close in a separate task, to ensure that it
runs to completion. Our loop waits on that task for 20s before giving
up, and allowing it to proceed in the background. This threshold seems
slightly more realistic than 5s, based on Claude's research into the
livekit crate.

### Changelog
- Fixed an issue where a gateway may stay connected to a room
  indefinitely after the last viewer has disconnected.

### Docs
None

### Links
Fixes: DB-1714

### Description
LiveKit has an upstream bug where `Room::close` can hang indefinitely.
For that reason, the SDK has a timeout. However, when the timeout is
reached, we drop the `Room`. That's the wrong thing to do, because the
`Room` doesn't impl `Drop`, and so we end up leaking our connection, and
staying in the room forever.

This change runs `Room::close` in a separate task, to ensure that it
runs to completion. Our loop waits on that task for 20s before giving
up, and allowing it to proceed in the background. This threshold seesm
slightly more realistic than 5s, based on Claude's research into the
livekit crate.
@gasmith gasmith self-assigned this Sep 4, 2026
@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

DB-1714

claude[bot]

This comment was marked as outdated.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants