Skip to content

Race condition for local track subscribed #462

Open
@tobowers

Description

@tobowers

Select which package(s) are affected

@livekit/rtc-node

Describe the bug

race condition in track subscription.

We have some code that that kept crashing our server yesterday. There's a problem with this line:

publication!.resolveFirstSubscription();

Where sometimes (it's really unclear when) the publication can be undefined:

TypeError#1: undefined is not an object (evaluating 'publication.resolveFirstSubscription')

You can see on that line that there's a ! in the typescript, so lint must have seen it.

This happened when we were reconnecting to a room with same participant name, same room name. So maybe the track was still published from the previous connection?

Reproduction

unfortunately not sure

Logs

System Info

Bun 1.2.8 
"@livekit/rtc-node": "^0.13.10",
"livekit-server-sdk": "^2.11.0",

LiveKit server version

LiveKit cloud

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions