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

feat: DH-18086: gRPC transport implementation for nodejs backed by http2 #2339

Merged
merged 5 commits into from
Jan 16, 2025

Conversation

bmingles
Copy link
Contributor

@bmingles bmingles commented Jan 9, 2025

DH-18086, DH-18085: gRPC transport implementation for nodejs backed by http2

Note that this is not consumed anywhere in the web but will be used by the vscode extension and tested on
deephaven/vscode-deephaven#202

@bmingles bmingles force-pushed the DH-18086-2_http2-grpc-transport branch from eb3a171 to c25f9cc Compare January 10, 2025 21:33
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.70%. Comparing base (6a08198) to head (2cd6ce2).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2339   +/-   ##
=======================================
  Coverage   46.70%   46.70%           
=======================================
  Files         704      704           
  Lines       39044    39044           
  Branches     9757     9757           
=======================================
  Hits        18234    18234           
  Misses      20799    20799           
  Partials       11       11           
Flag Coverage Δ
unit 46.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmingles bmingles marked this pull request as ready for review January 14, 2025 17:27
@bmingles bmingles requested review from a team and vbabich and removed request for a team January 14, 2025 17:27
cancel(): void {
logger.debug('cancel');
assertNotNull(this.request, 'request is required');
this.request.close();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we reset request to null here? Probably not needed, if request.write handles closed requests fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. @niloc132 do you have any thoughts on this one?

Copy link
Member

Choose a reason for hiding this comment

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

It looks safe to me to not null out - but nulling it out does come with the benefit of clearly showing why an error happened if it is reused somehow. I'm certainly not against that style of defensive coding, but I think we'd want to update a few other places too to reflect this.

GC-wise, I don't see any issue with the current implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opting to leave as-is for now to avoid adding complexity. Setting to null will require changes to start which assumes this stays set to know if it has already been called.

packages/jsapi-nodejs/src/NodeHttp2gRPCTransport.ts Outdated Show resolved Hide resolved
cancel(): void {
logger.debug('cancel');
assertNotNull(this.request, 'request is required');
this.request.close();
Copy link
Member

Choose a reason for hiding this comment

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

It looks safe to me to not null out - but nulling it out does come with the benefit of clearly showing why an error happened if it is reused somehow. I'm certainly not against that style of defensive coding, but I think we'd want to update a few other places too to reflect this.

GC-wise, I don't see any issue with the current implementation.

@bmingles bmingles requested a review from vbabich January 16, 2025 16:59
vbabich
vbabich previously approved these changes Jan 16, 2025
@@ -177,7 +177,6 @@ export class NodeHttp2gRPCTransport implements GrpcTransport {
logger.debug('cancel');
assertNotNull(this.request, 'request is required');
this.request.close();
this.request = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vbabich I ended up reverting this as Colin pointed out this breaks the check in the start method to avoid calling start multiple times. We could make the state logic smarter, but I think it will introduce complexity that can't easily be tested. Probably best to leave simple for now, unless we run into any particular problems.

@bmingles bmingles requested a review from vbabich January 16, 2025 17:41
@bmingles bmingles merged commit 3b5c7d3 into deephaven:main Jan 16, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2025
@bmingles bmingles deleted the DH-18086-2_http2-grpc-transport branch January 16, 2025 19:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants