Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various RPC issues #2764

Merged
merged 3 commits into from
Sep 21, 2024
Merged

Fix various RPC issues #2764

merged 3 commits into from
Sep 21, 2024

Conversation

kentonv
Copy link
Member

@kentonv kentonv commented Sep 20, 2024

See commit descriptions.

First issue caused spurious Sentry errors.

Other two issues @geelen complained about.

This could happen if someone tried to pipeline on a call that returned a primitive type. The error was reported as an internal runtime error instead of being reported to the app.

Now the application will get a reasonable error thrown at it.
…osal.

If an RPC returns a plain object (with no stubs and no disposer), then it should not be necessary to call its disposer on the caller side.

I had explicitly accounted for this in the protocol, but forgot to handle it correctly in the code! So the callee context would be held open until the caller disposed the result. If the caller didn't do that, the callee would be held open until the caller context ended.
@kentonv kentonv requested review from geelen and jasnell September 20, 2024 23:22
@kentonv kentonv requested review from a team as code owners September 20, 2024 23:22
@kentonv kentonv requested a review from anonrig September 20, 2024 23:22
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Typo in the function name but otherwise lgtm.

src/workerd/jsg/jsvalue.h Outdated Show resolved Hide resolved
This makes `assert.deepEqual()` work on RPC results, without having to delete the disposer first.
@kentonv kentonv force-pushed the kenton/fix-rpc-issues branch from c289362 to a0b780f Compare September 20, 2024 23:42
Copy link
Collaborator

@geelen geelen left a comment

Choose a reason for hiding this comment

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

Fantastic! Pleased these didn't require bigger rework. Will make testing RPC APIs way cleaner 🙏

@kentonv kentonv merged commit 17dc652 into main Sep 21, 2024
14 checks passed
@kentonv kentonv deleted the kenton/fix-rpc-issues branch September 21, 2024 14:21
kentonv added a commit that referenced this pull request Sep 23, 2024
Fix test flake in js-rpc-socket-test, introduced in #2764.
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.

4 participants