Skip to content

Address race condition in rpc timeout logic#1958

Merged
1egoman merged 2 commits into
mainfrom
rpc-timeout-fix
Jun 2, 2026
Merged

Address race condition in rpc timeout logic#1958
1egoman merged 2 commits into
mainfrom
rpc-timeout-fix

Conversation

@1egoman
Copy link
Copy Markdown
Contributor

@1egoman 1egoman commented Jun 1, 2026

In RpcClientManager's performRpc method, there was some code roughly like this:

setTimeout(() => {
  clearTimeout(id);
}, /* arbitrary delay a */);

await variableDurationAsyncFunction();

const id = setTimeout(() => { /* ... */ }, /* arbitrary delay b */);

If variableDurationAsyncFunction takes longer to run than arbitrary delay a, then it's possible that clearTimeout(id) could run before id gets assigned. Fix this so that id is explictly hoisted and set to null, and then only actually cleared if it is non-null.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: 83209e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 100.24 KB (-0.04% 🔽)
dist/livekit-client.umd.js 109.32 KB (-0.07% 🔽)

@1egoman 1egoman merged commit 59d29ab into main Jun 2, 2026
7 checks passed
@1egoman 1egoman deleted the rpc-timeout-fix branch June 2, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants