Merge remote-tracking branch 'upstream/@grpc/grpc-js@1.3.x' into grpc-js_1.3_upmerge

This commit is contained in:
Michael Lumish 2021-08-10 09:56:36 -07:00
commit 770ffefe5b
3 changed files with 20 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.3.6",
"version": "1.3.7",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -660,7 +660,15 @@ export class Http2CallStream implements Call {
this.pendingWrite.length +
' (deferred)'
);
stream.write(this.pendingWrite, this.pendingWriteCallback);
try {
stream.write(this.pendingWrite, this.pendingWriteCallback);
} catch (error) {
this.endCall({
code: Status.UNAVAILABLE,
details: `Write failed with error ${error.message}`,
metadata: new Metadata()
});
}
}
this.maybeCloseWrites();
}
@ -788,7 +796,15 @@ export class Http2CallStream implements Call {
this.pendingWriteCallback = cb;
} else {
this.trace('sending data chunk of length ' + message.message.length);
this.http2Stream.write(message.message, cb);
try {
this.http2Stream.write(message.message, cb);
} catch (error) {
this.endCall({
code: Status.UNAVAILABLE,
details: `Write failed with error ${error.message}`,
metadata: new Metadata()
});
}
this.maybeCloseWrites();
}
}, this.handleFilterError.bind(this));

View File

@ -431,7 +431,7 @@ export class Http2ServerCallStream<
private checkCancelled(): boolean {
/* In some cases the stream can become destroyed before the close event
* fires. That creates a race condition that this check works around */
if (this.stream.destroyed) {
if (this.stream.destroyed || this.stream.closed) {
this.cancelled = true;
}
return this.cancelled;