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

native AbortController.abort() is always called when stream is ended #218

Closed
AVVS opened this issue Oct 14, 2022 · 3 comments · Fixed by #229
Closed

native AbortController.abort() is always called when stream is ended #218

AVVS opened this issue Oct 14, 2022 · 3 comments · Fixed by #229

Comments

@AVVS
Copy link

AVVS commented Oct 14, 2022

Hi, @grpc/grpc-js always emits 'cancelled' event on 'close', which results in AbortController.abort being called each request. This, in turn, creates new DomException, which leads to stack trace capture and is extremely slow. One way to avoid it is to pass optional reason straight from the grpc. This should give a substantial boost in performance (I'm seeing about 10-15% throughput increase depending on the hardware)

@aikoven
Copy link
Contributor

aikoven commented Oct 17, 2022

Thanks for the report. Seems like a bug — the signal should not be aborted on normal stream end, only when the call is cancelled.

@AVVS
Copy link
Author

AVVS commented Oct 22, 2022

I've submitted a fix to @grpc/grpc-js for that, believe it has been release by now. That should sort the issue here

@aikoven
Copy link
Contributor

aikoven commented Nov 2, 2022

I have added some tests for this in #229 and can confirm that updating grpc-js to 1.7.3 makes them all pass.

Thanks again!

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 a pull request may close this issue.

2 participants