From 8f724121a28e54343ee4c8e4fb97126006480b2d Mon Sep 17 00:00:00 2001 From: Dmitry Cheryasov Date: Mon, 20 May 2019 15:36:15 -0500 Subject: [PATCH 01/38] Fix a TypeError loading a non-existent proto file. The issue: https://github.com/grpc/grpc-node/issues/876 This is an obvious typo; `typeof` has to return a string `'undefined'`, not a literal `undefined.` --- packages/proto-loader/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/proto-loader/src/index.ts b/packages/proto-loader/src/index.ts index 563f58f5..4e17719e 100644 --- a/packages/proto-loader/src/index.ts +++ b/packages/proto-loader/src/index.ts @@ -121,7 +121,7 @@ function getAllHandledReflectionObjects( if (isHandledReflectionObject(obj)) { return [[objName, obj]]; } else { - if (isNamespaceBase(obj) && typeof obj.nested !== undefined) { + if (isNamespaceBase(obj) && typeof obj.nested !== 'undefined') { return Object.keys(obj.nested!) .map((name) => { return getAllHandledReflectionObjects(obj.nested![name], objName); From 69f97495ac19bb3b0f4274b309883735fd62ff20 Mon Sep 17 00:00:00 2001 From: Cosmin Lehene Date: Tue, 2 Jul 2019 14:39:49 -0700 Subject: [PATCH 02/38] Fix Channel argument validation error messages --- packages/grpc-native-core/ext/channel.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/grpc-native-core/ext/channel.cc b/packages/grpc-native-core/ext/channel.cc index 14293abd..fa7f8419 100644 --- a/packages/grpc-native-core/ext/channel.cc +++ b/packages/grpc-native-core/ext/channel.cc @@ -207,7 +207,7 @@ NAN_METHOD(Channel::New) { if (info.IsConstructCall()) { if (!info[0]->IsString()) { return Nan::ThrowTypeError( - "Channel expects a string, a credential and an object"); + "Channel's first argument (address) must be a string"); } grpc_channel *wrapped_channel; // Owned by the Channel object @@ -215,7 +215,7 @@ NAN_METHOD(Channel::New) { grpc_channel_credentials *creds; if (!ChannelCredentials::HasInstance(info[1])) { return Nan::ThrowTypeError( - "Channel's second argument must be a ChannelCredentials"); + "Channel's second argument (credentials) must be a ChannelCredentials"); } ChannelCredentials *creds_object = ObjectWrap::Unwrap( Nan::To(info[1]).ToLocalChecked()); @@ -224,7 +224,7 @@ NAN_METHOD(Channel::New) { if (!ParseChannelArgs(info[2], &channel_args_ptr)) { DeallocateChannelArgs(channel_args_ptr); return Nan::ThrowTypeError( - "Channel options must be an object with " + "Channel third argument (options) must be an object with " "string keys and integer or string values"); } if (creds == NULL) { From ec91a169707296179dcad8bcbc653cd10a6dbd18 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Sat, 6 Jul 2019 14:07:31 -0700 Subject: [PATCH 03/38] Build Electron 4.2 artifacts 4.0 and 4.1 were there but not 4.2 https://github.com/grpc/grpc-node/issues/937 --- .../tools/run_tests/artifacts/build_artifact_electron.bat | 2 +- .../tools/run_tests/artifacts/build_artifact_electron.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.bat b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.bat index 95ca024d..89e38730 100644 --- a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.bat +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.bat @@ -14,7 +14,7 @@ set arch_list=ia32 x64 -set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 5.0.0 +set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 4.2.0 5.0.0 set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.sh b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.sh index 6eb65014..72c9b36f 100755 --- a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.sh +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.sh @@ -16,7 +16,7 @@ set -ex arch_list=( ia32 x64 ) -electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 5.0.0 ) +electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 4.2.0 5.0.0 ) umask 022 From 986979bda9e4411dbb08e8a9cb4a3533ebf9276a Mon Sep 17 00:00:00 2001 From: Mike Ajala <10845154+agmt5989@users.noreply.github.com> Date: Sun, 7 Jul 2019 23:59:49 +0100 Subject: [PATCH 04/38] Updated README.md Corrected a few typos and semantics in the readme file. --- packages/grpc-native-core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-native-core/README.md b/packages/grpc-native-core/README.md index 1dd78c8c..f9b6bc1a 100644 --- a/packages/grpc-native-core/README.md +++ b/packages/grpc-native-core/README.md @@ -28,7 +28,7 @@ The `--build-from-source` option will work even when installing another package The official electron documentation recommends to [build all of your native packages from source](https://electronjs.org/docs/tutorial/using-native-node-modules#modules-that-rely-on-node-pre-gyp). While the reasons behind this are technically good - many native extensions won't be packaged to work properly with electron - the gRPC source code is fairly difficult to build from source due to its complex nature, and we're also providing working electron pre-built binaries. Therefore, we recommend that you do not follow this model for using gRPC with electron. Also, for the same reason, `electron-rebuild` will always build from source. We advise you to not use this tool if you are depending on gRPC. Please note that there's not just one way to get native extensions running in electron, and that there's never any silver bullet for anything. The following instructions try to cater about some of the most generic ways, but different edge cases might require different methodologies. -The best to get gRPC to work with electron is to do this, possibly in your `postinstall` script of your `package.json` file: +The best way to get gRPC to work with electron is to do this, possibly in the `postinstall` script of your `package.json` file: ``` npm rebuild --target=2.0.0 --runtime=electron --dist-url=https://atom.io/download/electron From aa54122e51ec57b03baadc0695557c542913f71b Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Mon, 8 Jul 2019 20:15:57 +0200 Subject: [PATCH 05/38] fix: properly handle http error status codes fix #941 --- packages/grpc-js/src/call-stream.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index 35b957b3..2f2c35b0 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -243,24 +243,24 @@ export class Http2CallStream extends Duplex implements Call { } else { this.http2Stream = stream; stream.on('response', (headers, flags) => { - switch (headers[HTTP2_HEADER_STATUS]) { + switch (headers[':status']) { // TODO(murgatroid99): handle 100 and 101 - case '400': + case 400: this.mappedStatusCode = Status.INTERNAL; break; - case '401': + case 401: this.mappedStatusCode = Status.UNAUTHENTICATED; break; - case '403': + case 403: this.mappedStatusCode = Status.PERMISSION_DENIED; break; - case '404': + case 404: this.mappedStatusCode = Status.UNIMPLEMENTED; break; - case '429': - case '502': - case '503': - case '504': + case 429: + case 502: + case 503: + case 504: this.mappedStatusCode = Status.UNAVAILABLE; break; default: From 3f460716fba3ba37e7acc50c52676c6714ca9138 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 9 Jul 2019 10:52:51 -0700 Subject: [PATCH 06/38] Remove check in grpc-js that doesn't appear in grpc --- packages/grpc-js/src/client.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/grpc-js/src/client.ts b/packages/grpc-js/src/client.ts index 5b243c38..a092e61d 100644 --- a/packages/grpc-js/src/client.ts +++ b/packages/grpc-js/src/client.ts @@ -139,11 +139,6 @@ export class Client { ); } }); - call.on('end', () => { - if (responseMessage == null) { - call.cancelWithStatus(Status.INTERNAL, 'Not enough responses received'); - } - }); call.on('status', (status: StatusObject) => { /* We assume that call emits status after it emits end, and that it * accounts for any cancelWithStatus calls up until it emits status. From 26e30ab136d8ec00106fd8d67844e5df651a4df8 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 9 Jul 2019 12:39:06 -0700 Subject: [PATCH 07/38] Fix 'noImplicitAny' issue with declaration file. The latest release of grpc-node cannot be used in a typescript project that uses -noImplicitAny. This is due to a signature being added without a specified return type. This causes the return type to implicitly be 'any' which TS explicitly disallows. For projects that use strict flags to catch lots of bugs, this prevents usage of this version of grpc entirely. --- packages/grpc-native-core/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-native-core/index.d.ts b/packages/grpc-native-core/index.d.ts index 841da737..718f6bdb 100644 --- a/packages/grpc-native-core/index.d.ts +++ b/packages/grpc-native-core/index.d.ts @@ -579,7 +579,7 @@ declare module "grpc" { * These options only have any effect when passed at the beginning of * a client request. */ - setOptions(options: MetadataOptions); + setOptions(options: MetadataOptions): void; } export type MetadataValue = string | Buffer; From d223cc394e8eb8064b98bb92601d2a714888f9d5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 9 Jul 2019 15:30:29 -0700 Subject: [PATCH 08/38] Bump grpc-js to 0.5.1 --- packages/grpc-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 3ff6ec73..0f10c8f4 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "0.5.0", + "version": "0.5.1", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", From 5b87ceb05c9b2251f271a81a49dd8afa2161598d Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 11 Jul 2019 14:30:22 -0700 Subject: [PATCH 09/38] Warn instead of failing when constructing metadata from remote end --- packages/grpc-js/src/metadata.ts | 41 ++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/packages/grpc-js/src/metadata.ts b/packages/grpc-js/src/metadata.ts index d321b9b0..72bb7072 100644 --- a/packages/grpc-js/src/metadata.ts +++ b/packages/grpc-js/src/metadata.ts @@ -62,7 +62,7 @@ function validate(key: string, value?: MetadataValue): void { } } -interface MetadataOptions { +export interface MetadataOptions { /* Signal that the request is idempotent. Defaults to false */ idempotentRequest?: boolean; /* Signal that the call should not return UNAVAILABLE before it has @@ -240,24 +240,29 @@ export class Metadata { const values = headers[key]; - if (isBinaryKey(key)) { - if (Array.isArray(values)) { - values.forEach(value => { - result.add(key, Buffer.from(value, 'base64')); - }); - } else if (values !== undefined) { - values.split(',').forEach(v => { - result.add(key, Buffer.from(v.trim(), 'base64')); - }); - } - } else { - if (Array.isArray(values)) { - values.forEach(value => { - result.add(key, value); - }); - } else if (values !== undefined) { - values.split(',').forEach(v => result.add(key, v.trim())); + try { + if (isBinaryKey(key)) { + if (Array.isArray(values)) { + values.forEach(value => { + result.add(key, Buffer.from(value, 'base64')); + }); + } else if (values !== undefined) { + values.split(',').forEach(v => { + result.add(key, Buffer.from(v.trim(), 'base64')); + }); + } + } else { + if (Array.isArray(values)) { + values.forEach(value => { + result.add(key, value); + }); + } else if (values !== undefined) { + values.split(',').forEach(v => result.add(key, v.trim())); + } } + } catch (error) { + error.message = `Failed to add metadata entry ${key}: ${values}. ${error.message}`; + process.emitWarning(error); } }); return result; From 4818d304c9af04995199b3aa742a943979c27cb1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 11 Jul 2019 16:46:53 -0700 Subject: [PATCH 10/38] Bump grpc-js to 0.5.2 --- packages/grpc-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 0f10c8f4..ff18d374 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "0.5.1", + "version": "0.5.2", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", From 277d9892f894822f486154bd5b456460a20facea Mon Sep 17 00:00:00 2001 From: Bjorn Stromberg Date: Fri, 12 Jul 2019 10:50:50 +0900 Subject: [PATCH 11/38] Add @types/semver as devDependency --- packages/grpc-js/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index ff18d374..88978f0a 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -19,6 +19,7 @@ "@types/lodash": "^4.14.108", "@types/mocha": "^5.2.6", "@types/node": "^12.0.2", + "@types/semver": "^6.0.1", "clang-format": "^1.0.55", "gts": "^1.0.0", "lodash": "^4.17.4", @@ -43,7 +44,7 @@ "posttest": "npm run check" }, "dependencies": { - "semver": "^6.0.0" + "semver": "^6.2.0" }, "files": [ "build/src/*.{js,d.ts}", From 201dab7fa8309c64c90514cd888678b1ab5eba09 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 16 Jul 2019 14:15:55 -0700 Subject: [PATCH 12/38] Improve server-related types exported by grpc-js --- packages/grpc-js/src/index.ts | 9 ++++++- packages/grpc-js/src/server-call.ts | 37 ++++++++++++++++------------- packages/grpc-js/src/server.ts | 18 +++++++------- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/packages/grpc-js/src/index.ts b/packages/grpc-js/src/index.ts index d846b6c0..8c5851bf 100644 --- a/packages/grpc-js/src/index.ts +++ b/packages/grpc-js/src/index.ts @@ -38,9 +38,10 @@ import { Serialize, } from './make-client'; import { Metadata } from './metadata'; -import { Server } from './server'; +import { Server, UntypedHandleCall, UntypedServiceImplementation } from './server'; import { KeyCertPair, ServerCredentials } from './server-credentials'; import { StatusBuilder } from './status-builder'; +import { ServerUnaryCall, ServerReadableStream, ServerWritableStream, ServerDuplexStream } from './server-call'; const supportedNodeVersions = require('../../package.json').engines.node; if (!semver.satisfies(process.version, supportedNodeVersions)) { @@ -213,6 +214,12 @@ export { CallOptions, StatusObject, ServiceError, + ServerUnaryCall, + ServerReadableStream, + ServerWritableStream, + ServerDuplexStream, + UntypedHandleCall, + UntypedServiceImplementation }; /* tslint:disable:no-any */ diff --git a/packages/grpc-js/src/server-call.ts b/packages/grpc-js/src/server-call.ts index 23d6b247..34d13b78 100644 --- a/packages/grpc-js/src/server-call.ts +++ b/packages/grpc-js/src/server-call.ts @@ -18,13 +18,14 @@ import { EventEmitter } from 'events'; import * as http2 from 'http2'; import { Duplex, Readable, Writable } from 'stream'; +import * as util from 'util'; -import { ServiceError } from './call'; import { StatusObject } from './call-stream'; import { Status } from './constants'; import { Deserialize, Serialize } from './make-client'; import { Metadata } from './metadata'; import { StreamDecoder } from './stream-decoder'; +import { ObjectReadable, ObjectWritable } from './object-stream'; interface DeadlineUnitIndexSignature { [name: string]: number; @@ -56,6 +57,10 @@ const defaultResponseOptions = { waitForTrailers: true, } as http2.ServerStreamResponseOptions; +export type ServerStatusResponse = Partial; + +export type ServerErrorResponse = ServerStatusResponse & Error; + export type ServerSurfaceCall = { cancelled: boolean; getPeer(): string; @@ -68,13 +73,13 @@ export type ServerUnaryCall = ServerSurfaceCall & { export type ServerReadableStream< RequestType, ResponseType -> = ServerSurfaceCall & Readable; +> = ServerSurfaceCall & ObjectReadable; export type ServerWritableStream< RequestType, ResponseType -> = ServerSurfaceCall & Writable & { request: RequestType | null }; +> = ServerSurfaceCall & ObjectWritable & { request: RequestType | null }; export type ServerDuplexStream = ServerSurfaceCall & - Duplex; + ObjectReadable & ObjectWritable; export class ServerUnaryCallImpl extends EventEmitter implements ServerUnaryCall { @@ -152,7 +157,7 @@ export class ServerWritableStreamImpl this.call.setupSurfaceCall(this); this.on('error', err => { - this.call.sendError(err as ServiceError); + this.call.sendError(err); this.end(); }); } @@ -223,7 +228,7 @@ export class ServerDuplexStreamImpl extends Duplex this.call.setupReadable(this); this.on('error', err => { - this.call.sendError(err as ServiceError); + this.call.sendError(err); this.end(); }); } @@ -247,7 +252,7 @@ ServerDuplexStreamImpl.prototype.end = ServerWritableStreamImpl.prototype.end; // Unary response callback signature. export type sendUnaryData = ( - error: ServiceError | null, + error: ServerErrorResponse | ServerStatusResponse | null, value: ResponseType | null, trailer?: Metadata, flags?: number @@ -339,7 +344,7 @@ export class Http2ServerCallStream< ) { super(); - this.stream.once('error', (err: ServiceError) => { + this.stream.once('error', (err: ServerErrorResponse) => { err.code = Status.INTERNAL; this.sendError(err); }); @@ -379,7 +384,7 @@ export class Http2ServerCallStream< const match = timeoutHeader[0].toString().match(DEADLINE_REGEX); if (match === null) { - const err = new Error('Invalid deadline') as ServiceError; + const err = new Error('Invalid deadline') as ServerErrorResponse; err.code = Status.OUT_OF_RANGE; this.sendError(err); return; @@ -439,7 +444,7 @@ export class Http2ServerCallStream< } async sendUnaryMessage( - err: ServiceError | null, + err: ServerErrorResponse | ServerStatusResponse | null, value: ResponseType | null, metadata?: Metadata, flags?: number @@ -490,21 +495,21 @@ export class Http2ServerCallStream< } } - sendError(error: ServiceError) { + sendError(error: ServerErrorResponse | ServerStatusResponse) { const status: StatusObject = { code: Status.UNKNOWN, - details: error.hasOwnProperty('message') + details: ('message' in error) ? error.message : 'Unknown Error', - metadata: error.hasOwnProperty('metadata') + metadata: ('metadata' in error && error.metadata !== undefined) ? error.metadata : new Metadata(), }; - if (error.hasOwnProperty('code') && Number.isInteger(error.code)) { + if ('code' in error && util.isNumber(error.code) && Number.isInteger(error.code)) { status.code = error.code; - if (error.hasOwnProperty('details')) { + if ('details' in error && util.isString(error.details)) { status.details = error.details; } } @@ -637,7 +642,7 @@ export class Http2ServerCallStream< type UntypedServerCall = Http2ServerCallStream; function handleExpiredDeadline(call: UntypedServerCall) { - const err = new Error('Deadline exceeded') as ServiceError; + const err = new Error('Deadline exceeded') as ServerErrorResponse; err.code = Status.DEADLINE_EXCEEDED; call.sendError(err); diff --git a/packages/grpc-js/src/server.ts b/packages/grpc-js/src/server.ts index e6d17619..a568f9c1 100644 --- a/packages/grpc-js/src/server.ts +++ b/packages/grpc-js/src/server.ts @@ -41,6 +41,8 @@ import { ServerWritableStream, ServerWritableStreamImpl, UnaryHandler, + ServerErrorResponse, + ServerStatusResponse, } from './server-call'; import { ServerCredentials } from './server-credentials'; @@ -57,9 +59,9 @@ type UntypedUnaryHandler = UnaryHandler; type UntypedClientStreamingHandler = ClientStreamingHandler; type UntypedServerStreamingHandler = ServerStreamingHandler; type UntypedBidiStreamingHandler = BidiStreamingHandler; -type UntypedHandleCall = HandleCall; +export type UntypedHandleCall = HandleCall; type UntypedHandler = Handler; -interface UntypedServiceImplementation { +export interface UntypedServiceImplementation { [name: string]: UntypedHandleCall; } @@ -100,7 +102,7 @@ export class Server { throw new Error('Not implemented. Use addService() instead'); } - addService(service: ServiceDefinition, implementation: object): void { + addService(service: ServiceDefinition, implementation: UntypedServiceImplementation): void { if (this.started === true) { throw new Error("Can't add a service to a started server."); } @@ -120,8 +122,6 @@ export class Server { throw new Error('Cannot add an empty service to a server'); } - const implMap: UntypedServiceImplementation = implementation as UntypedServiceImplementation; - serviceKeys.forEach(name => { const attrs = service[name]; let methodType: HandlerType; @@ -140,11 +140,11 @@ export class Server { } } - let implFn = implMap[name]; + let implFn = implementation[name]; let impl; if (implFn === undefined && typeof attrs.originalName === 'string') { - implFn = implMap[attrs.originalName]; + implFn = implementation[attrs.originalName]; } if (implFn !== undefined) { @@ -414,7 +414,7 @@ async function handleUnary( handler.func( emitter, ( - err: ServiceError | null, + err: ServerErrorResponse | ServerStatusResponse | null, value: ResponseType | null, trailer?: Metadata, flags?: number @@ -436,7 +436,7 @@ function handleClientStreaming( ); function respond( - err: ServiceError | null, + err: ServerErrorResponse | ServerStatusResponse | null, value: ResponseType | null, trailer?: Metadata, flags?: number From 0dc0b68197f4a1787188a1faaee65289b4813806 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 16 Jul 2019 14:21:42 -0700 Subject: [PATCH 13/38] Fix typo in native types file --- packages/grpc-native-core/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/grpc-native-core/index.d.ts b/packages/grpc-native-core/index.d.ts index 718f6bdb..bba7be72 100644 --- a/packages/grpc-native-core/index.d.ts +++ b/packages/grpc-native-core/index.d.ts @@ -412,13 +412,13 @@ declare module "grpc" { * User provided method to handle server streaming methods on the server. */ type handleServerStreamingCall = - (call: ServerWriteableStream) => void; + (call: ServerWritableStream) => void; /** * A stream that the server can write to. Used for calls that are streaming * from the server side. */ - export class ServerWriteableStream extends Writable { + export class ServerWritableStream extends Writable { /** * Indicates if the call has been cancelled */ @@ -449,6 +449,10 @@ declare module "grpc" { sendMetadata(responseMetadata: Metadata): void; } + /* This typo existed in previous versions of this file, so we provide this + * type alias for backwards compatibility. */ + export type ServerWriteableStream = ServerWritableStream; + /** * User provided method to handle bidirectional streaming calls on the server. */ From 80d7057cad4c71139b1544407279fed51908e758 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 29 Jul 2019 13:50:51 -0700 Subject: [PATCH 14/38] Use typeof instead of util functions --- packages/grpc-js/src/server-call.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/grpc-js/src/server-call.ts b/packages/grpc-js/src/server-call.ts index 34d13b78..c9a6b3f7 100644 --- a/packages/grpc-js/src/server-call.ts +++ b/packages/grpc-js/src/server-call.ts @@ -18,7 +18,6 @@ import { EventEmitter } from 'events'; import * as http2 from 'http2'; import { Duplex, Readable, Writable } from 'stream'; -import * as util from 'util'; import { StatusObject } from './call-stream'; import { Status } from './constants'; @@ -506,11 +505,11 @@ export class Http2ServerCallStream< : new Metadata(), }; - if ('code' in error && util.isNumber(error.code) && Number.isInteger(error.code)) { + if ('code' in error && typeof error.code === 'number' && Number.isInteger(error.code)) { status.code = error.code; - if ('details' in error && util.isString(error.details)) { - status.details = error.details; + if ('details' in error && typeof error.details === 'string') { + status.details = error.details!; } } From e2e6d14675721baeb1d7bd50b6baac383104be66 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 30 Jul 2019 10:25:24 -0700 Subject: [PATCH 15/38] Set grpc-health-check version to 1.7.0 --- packages/grpc-health-check/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-health-check/package.json b/packages/grpc-health-check/package.json index 4ff2e33a..d2e1a9a2 100644 --- a/packages/grpc-health-check/package.json +++ b/packages/grpc-health-check/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/health-check", - "version": "1.8.0-dev", + "version": "1.7.0", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { From 2e16f16ec472aac320a13b4bd7821ef86163634a Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 30 Jul 2019 11:01:44 -0700 Subject: [PATCH 16/38] Add upb configuration to native-core --- packages/grpc-native-core/binding.gyp | 5 ++++- packages/grpc-native-core/package.json | 8 +++++--- packages/grpc-native-core/templates/binding.gyp.template | 5 ++++- packages/grpc-native-core/templates/package.json.template | 8 +++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/grpc-native-core/binding.gyp b/packages/grpc-native-core/binding.gyp index 06fcb76e..6dae2c5b 100644 --- a/packages/grpc-native-core/binding.gyp +++ b/packages/grpc-native-core/binding.gyp @@ -83,11 +83,14 @@ 'include_dirs': [ 'deps/grpc', 'deps/grpc/include', + 'deps/grpc/src/core/ext/upb-generated', + 'deps/grpc/third_party/abseil-cpp', 'deps/grpc/third_party/address_sorting/include', 'deps/grpc/third_party/cares', 'deps/grpc/third_party/cares/cares', - 'deps/grpc/third_party/abseil-cpp', 'deps/grpc/third_party/nanopb', + 'deps/grpc/third_party/upb', + 'deps/grpc/third_party/upb/generated_for_cmake', ], 'defines': [ 'PB_FIELD_32BIT', diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 870f4056..ad6d2f5b 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -68,13 +68,15 @@ "deps/grpc/include/grpc/**/*.h", "deps/grpc/src/core/**/*.{c,cc,h}", "deps/grpc/src/boringssl/err_data.c", - "deps/grpc/third_party/nanopb/*.{c,cc,h}", - "deps/grpc/third_party/zlib/**/*.{c,cc,h}", + "deps/grpc/third_party/abseil-cpp/absl/**/*.{h,hh}", "deps/grpc/third_party/boringssl/crypto/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/include/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/ssl/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/third_party/**/*.{c,h}", - "deps/grpc/third_party/abseil-cpp/absl/**/*.{h,hh}", + "deps/grpc/third_party/nanopb/*.{c,cc,h}", + "deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/*.{c,h}", + "deps/grpc/third_party/upb/upb/*.{c,h}", + "deps/grpc/third_party/zlib/**/*.{c,cc,h}", "binding.gyp" ], "main": "index.js", diff --git a/packages/grpc-native-core/templates/binding.gyp.template b/packages/grpc-native-core/templates/binding.gyp.template index 8c145d4a..cdf1a1a0 100644 --- a/packages/grpc-native-core/templates/binding.gyp.template +++ b/packages/grpc-native-core/templates/binding.gyp.template @@ -75,11 +75,14 @@ 'include_dirs': [ 'deps/grpc', 'deps/grpc/include', + 'deps/grpc/src/core/ext/upb-generated', + 'deps/grpc/third_party/abseil-cpp', 'deps/grpc/third_party/address_sorting/include', 'deps/grpc/third_party/cares', 'deps/grpc/third_party/cares/cares', - 'deps/grpc/third_party/abseil-cpp', 'deps/grpc/third_party/nanopb', + 'deps/grpc/third_party/upb', + 'deps/grpc/third_party/upb/generated_for_cmake', ], 'defines': [ 'PB_FIELD_32BIT', diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index 9949797c..be994bf1 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -70,13 +70,15 @@ "deps/grpc/include/grpc/**/*.h", "deps/grpc/src/core/**/*.{c,cc,h}", "deps/grpc/src/boringssl/err_data.c", - "deps/grpc/third_party/nanopb/*.{c,cc,h}", - "deps/grpc/third_party/zlib/**/*.{c,cc,h}", + "deps/grpc/third_party/abseil-cpp/absl/**/*.{h,hh}", "deps/grpc/third_party/boringssl/crypto/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/include/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/ssl/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/third_party/**/*.{c,h}", - "deps/grpc/third_party/abseil-cpp/absl/**/*.{h,hh}", + "deps/grpc/third_party/nanopb/*.{c,cc,h}", + "deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/*.{c,h}", + "deps/grpc/third_party/upb/upb/*.{c,h}", + "deps/grpc/third_party/zlib/**/*.{c,cc,h}", "binding.gyp" ], "main": "index.js", From bb57faeb7bdde73794c9a7173d209ed783d9bad7 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 30 Jul 2019 11:34:59 -0700 Subject: [PATCH 17/38] Update by code review --- packages/grpc-native-core/package.json | 3 +-- packages/grpc-native-core/templates/package.json.template | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index ad6d2f5b..ed360a39 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -74,8 +74,7 @@ "deps/grpc/third_party/boringssl/ssl/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/third_party/**/*.{c,h}", "deps/grpc/third_party/nanopb/*.{c,cc,h}", - "deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/*.{c,h}", - "deps/grpc/third_party/upb/upb/*.{c,h}", + "deps/grpc/third_party/upb/**/*.{c,h}", "deps/grpc/third_party/zlib/**/*.{c,cc,h}", "binding.gyp" ], diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index be994bf1..2d9bede7 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -76,8 +76,7 @@ "deps/grpc/third_party/boringssl/ssl/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/third_party/**/*.{c,h}", "deps/grpc/third_party/nanopb/*.{c,cc,h}", - "deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/*.{c,h}", - "deps/grpc/third_party/upb/upb/*.{c,h}", + "deps/grpc/third_party/upb/**/*.{c,h}", "deps/grpc/third_party/zlib/**/*.{c,cc,h}", "binding.gyp" ], From 49ffe9522e41f3c191467447c261d1e79307fe1c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 30 Jul 2019 12:51:07 -0700 Subject: [PATCH 18/38] Revert grpc-health-check name to original name --- packages/grpc-health-check/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-health-check/package.json b/packages/grpc-health-check/package.json index d2e1a9a2..e10de7c1 100644 --- a/packages/grpc-health-check/package.json +++ b/packages/grpc-health-check/package.json @@ -1,5 +1,5 @@ { - "name": "@grpc/health-check", + "name": "grpc-health-check", "version": "1.7.0", "author": "Google Inc.", "description": "Health check service for use with gRPC", From 81c579deae7f49fc75b5941de122504c2103401f Mon Sep 17 00:00:00 2001 From: Erik Silkensen <94125+esilkensen@users.noreply.github.com> Date: Sun, 4 Aug 2019 17:10:38 -0600 Subject: [PATCH 19/38] Fix typo in makeServerStreamRequest return type (grpc-native-core) --- packages/grpc-native-core/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-native-core/index.d.ts b/packages/grpc-native-core/index.d.ts index bba7be72..c7dab49d 100644 --- a/packages/grpc-native-core/index.d.ts +++ b/packages/grpc-native-core/index.d.ts @@ -1131,7 +1131,7 @@ declare module "grpc" { argument: RequestType, metadata?: Metadata | null, options?: CallOptions | null, - ): ClientReadableStream; + ): ClientReadableStream; /** * Make a bidirectional stream request with this method on the given channel. From 110461d78abd14e101ccc534f147b165a7025d40 Mon Sep 17 00:00:00 2001 From: Bjorn Stromberg Date: Wed, 17 Jul 2019 10:30:39 +0900 Subject: [PATCH 20/38] Add dev-dependencies and fix tests so they exit after running --- package.json | 2 +- packages/grpc-js/package.json | 13 ++++++++++++- packages/grpc-js/test/test-server.ts | 10 ++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e910715a..11d8e257 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "through2": "^2.0.3", "ts-node": "^8.1.0", "tslint": "^5.5.0", - "typescript": "~3.3.3333", + "typescript": "^3.5.3", "xml2js": "^0.4.19" }, "contributors": [ diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 88978f0a..51ff1cfd 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -16,14 +16,25 @@ "license": "Apache-2.0", "devDependencies": { "@grpc/proto-loader": "^0.5.0", + "@types/gulp": "^4.0.6", + "@types/gulp-mocha": "0.0.32", "@types/lodash": "^4.14.108", "@types/mocha": "^5.2.6", + "@types/ncp": "^2.0.1", "@types/node": "^12.0.2", + "@types/pify": "^3.0.2", "@types/semver": "^6.0.1", "clang-format": "^1.0.55", + "execa": "^2.0.3", "gts": "^1.0.0", + "gulp": "^4.0.2", + "gulp-mocha": "^6.0.0", "lodash": "^4.17.4", - "typescript": "~3.5.1" + "mocha-jenkins-reporter": "^0.4.1", + "ncp": "^2.0.0", + "pify": "^4.0.1", + "ts-node": "^8.3.0", + "typescript": "^3.5.3" }, "contributors": [ { diff --git a/packages/grpc-js/test/test-server.ts b/packages/grpc-js/test/test-server.ts index 3e02c3d5..434efbbc 100644 --- a/packages/grpc-js/test/test-server.ts +++ b/packages/grpc-js/test/test-server.ts @@ -86,7 +86,7 @@ describe('Server', () => { }); }); - it('throws if bind is called after the server is started', () => { + it('throws if bind is called after the server is started', done => { const server = new Server(); server.bindAsync( @@ -102,6 +102,7 @@ describe('Server', () => { noop ); }, /server is already started/); + server.tryShutdown(done); } ); }); @@ -243,7 +244,7 @@ describe('Server', () => { const mathClient = (loadProtoFile(mathProtoFile).math as any).Math; const mathServiceAttrs = mathClient.service; - beforeEach(done => { + before(done => { server = new Server(); server.addService(mathServiceAttrs, {}); server.bindAsync( @@ -261,6 +262,11 @@ describe('Server', () => { ); }); + after(done => { + client.close(); + server.tryShutdown(done); + }); + it('should respond to a unary call with UNIMPLEMENTED', done => { client.div( { divisor: 4, dividend: 3 }, From 20874af51c2384e0bc4a3a8ef58a4033be180e59 Mon Sep 17 00:00:00 2001 From: Kelly Campbell Date: Sat, 17 Aug 2019 14:11:48 -0400 Subject: [PATCH 21/38] Log internal errors from proto serialization/deserialization --- packages/grpc-native-core/src/server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/grpc-native-core/src/server.js b/packages/grpc-native-core/src/server.js index b79ee6fc..4b0aa3af 100644 --- a/packages/grpc-native-core/src/server.js +++ b/packages/grpc-native-core/src/server.js @@ -55,6 +55,9 @@ function handleError(call, error) { if (error.hasOwnProperty('details')) { status.details = error.details; } + if (status.code == constants.status.INTERNAL) { + common.log(constants.logVerbosity.ERROR, error); + } } if (error.hasOwnProperty('metadata')) { statusMetadata = error.metadata; From 629670bbd3f9be470a7780227ac60b6221f8374d Mon Sep 17 00:00:00 2001 From: David Raynes Date: Mon, 19 Aug 2019 14:12:44 -0400 Subject: [PATCH 22/38] Remove deprecated @types/protobufjs module --- packages/grpc-native-core/package.json | 1 - packages/grpc-native-core/templates/package.json.template | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index ed360a39..4605eb2a 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -29,7 +29,6 @@ "node-pre-gyp" ], "dependencies": { - "@types/protobufjs": "^5.0.31", "lodash.camelcase": "^4.3.0", "lodash.clone": "^4.5.0", "nan": "^2.13.2", diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index 2d9bede7..080567c5 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -31,7 +31,6 @@ "node-pre-gyp" ], "dependencies": { - "@types/protobufjs": "^5.0.31", "lodash.camelcase": "^4.3.0", "lodash.clone": "^4.5.0", "nan": "^2.13.2", From 10a7cc5e3afeddc160280d294b7cb4b23d0634e6 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 20 Aug 2019 09:36:58 -0700 Subject: [PATCH 23/38] Add MAINTAINERS.md --- MAINTAINERS.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 MAINTAINERS.md diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 00000000..0ef614d9 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,23 @@ +This page lists all active maintainers of this repository. If you were a +maintainer and would like to add your name to the Emeritus list, please send us a +PR. + +See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md) +for governance guidelines and how to become a maintainer. +See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) +for general contribution guidelines. + +## Maintainers (in alphabetical order) + - [jiangtaoli2016](https://github.com/jiangtaoli2016), Google Inc. + - [jtattermusch](https://github.com/jtattermusch), Google Inc. + - [kjin](https://github.com/kjin), Google Inc. + - [matt-kwong](https://github.com/matt-kwong), Google Inc. + - [murgatroid99](https://github.com/murgatroid99), Google Inc. + - [nicolasnoble](https://github.com/nicolasnoble), Google Inc. + - [ofrobots](https://github.com/ofrobots), Google Inc. + - [srini100](https://github.com/srini100), Google Inc. + - [WeiranFang](https://github.com/WeiranFang), Google Inc. + - [wenbozhu](https://github.com/wenbozhu), Google Inc. + + ## Emeritus Maintainers (in alphabetical order) + \ No newline at end of file From 3e486816ed13fd8e81ce7c39f9889028e1caf762 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 20 Aug 2019 11:10:58 -0700 Subject: [PATCH 24/38] Move two people to emeritus list --- MAINTAINERS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 0ef614d9..c9e0522a 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -10,8 +10,6 @@ for general contribution guidelines. ## Maintainers (in alphabetical order) - [jiangtaoli2016](https://github.com/jiangtaoli2016), Google Inc. - [jtattermusch](https://github.com/jtattermusch), Google Inc. - - [kjin](https://github.com/kjin), Google Inc. - - [matt-kwong](https://github.com/matt-kwong), Google Inc. - [murgatroid99](https://github.com/murgatroid99), Google Inc. - [nicolasnoble](https://github.com/nicolasnoble), Google Inc. - [ofrobots](https://github.com/ofrobots), Google Inc. @@ -20,4 +18,6 @@ for general contribution guidelines. - [wenbozhu](https://github.com/wenbozhu), Google Inc. ## Emeritus Maintainers (in alphabetical order) + - [kjin](https://github.com/kjin), Google Inc. + - [matt-kwong](https://github.com/matt-kwong), Google Inc. \ No newline at end of file From a17c53050a681fe5c48687cac0ab6f02a547e52e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 29 Aug 2019 15:03:27 -0700 Subject: [PATCH 25/38] Bump proto-loader to 0.5.2 --- packages/proto-loader/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/proto-loader/package.json b/packages/proto-loader/package.json index b1c713f4..d9ba9a79 100644 --- a/packages/proto-loader/package.json +++ b/packages/proto-loader/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/proto-loader", - "version": "0.5.1", + "version": "0.5.2", "author": "Google Inc.", "contributors": [ { From 4b4addf5b96189561fec523a5d2a9c97943b1699 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 6 Sep 2019 11:10:47 -0700 Subject: [PATCH 26/38] Add specific call error for TCP disconnection --- packages/grpc-js/src/call-stream.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index 2f2c35b0..b1d5fd96 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -342,6 +342,14 @@ export class Http2CallStream extends Duplex implements Call { * from bubbling up. However, errors here should all correspond to * "close" events, where we will handle the error more granularly */ }); + /* If the underlying TLS or TCP connection closes, we want to end the + * call with an UNAVAILABLE status to match the behavior of the other + * library. In this handler we don't wait for trailers before ending the + * call. This should ensure that this endCall happens sooner than the one + * in the stream.on('close', ...) handler. */ + stream.session.socket.on('close', () => { + this.endCall({code: Status.UNAVAILABLE, details: 'Connection dropped', metadata: new Metadata()}); + }); if (!this.pendingRead) { stream.pause(); } From ae334976568ffc9c90e14e775662ba86f0c0e030 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 6 Sep 2019 13:21:47 -0700 Subject: [PATCH 27/38] Check stream.session.socket before adding event handler --- packages/grpc-js/src/call-stream.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index b1d5fd96..67880212 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -342,14 +342,20 @@ export class Http2CallStream extends Duplex implements Call { * from bubbling up. However, errors here should all correspond to * "close" events, where we will handle the error more granularly */ }); - /* If the underlying TLS or TCP connection closes, we want to end the - * call with an UNAVAILABLE status to match the behavior of the other - * library. In this handler we don't wait for trailers before ending the - * call. This should ensure that this endCall happens sooner than the one - * in the stream.on('close', ...) handler. */ - stream.session.socket.on('close', () => { - this.endCall({code: Status.UNAVAILABLE, details: 'Connection dropped', metadata: new Metadata()}); - }); + /* For some reason, stream.session.socket can sometimes be undefined. + * When that happens trying to add this event handler throws an error. + * This check is a stopgap measure to get this working sometimes until + * we understand/eliminate those cases. */ + if (stream.session.socket) { + /* If the underlying TLS or TCP connection closes, we want to end the + * call with an UNAVAILABLE status to match the behavior of the other + * library. In this handler we don't wait for trailers before ending the + * call. This should ensure that this endCall happens sooner than the one + * in the stream.on('close', ...) handler. */ + stream.session.socket.on('close', () => { + this.endCall({code: Status.UNAVAILABLE, details: 'Connection dropped', metadata: new Metadata()}); + }); + } if (!this.pendingRead) { stream.pause(); } From 049da7e0586dd709c78b6fe6107663d3b30a9f06 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 6 Sep 2019 14:58:42 -0700 Subject: [PATCH 28/38] Add session.socket to ClientHttp2StreamMock in tests --- packages/grpc-js/src/call-stream.ts | 22 ++++++++-------------- packages/grpc-js/test/test-call-stream.ts | 3 ++- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index 67880212..d04eb9b6 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -342,20 +342,14 @@ export class Http2CallStream extends Duplex implements Call { * from bubbling up. However, errors here should all correspond to * "close" events, where we will handle the error more granularly */ }); - /* For some reason, stream.session.socket can sometimes be undefined. - * When that happens trying to add this event handler throws an error. - * This check is a stopgap measure to get this working sometimes until - * we understand/eliminate those cases. */ - if (stream.session.socket) { - /* If the underlying TLS or TCP connection closes, we want to end the - * call with an UNAVAILABLE status to match the behavior of the other - * library. In this handler we don't wait for trailers before ending the - * call. This should ensure that this endCall happens sooner than the one - * in the stream.on('close', ...) handler. */ - stream.session.socket.on('close', () => { - this.endCall({code: Status.UNAVAILABLE, details: 'Connection dropped', metadata: new Metadata()}); - }); - } + /* If the underlying TLS or TCP connection closes, we want to end the + * call with an UNAVAILABLE status to match the behavior of the other + * library. In this handler we don't wait for trailers before ending the + * call. This should ensure that this endCall happens sooner than the one + * in the stream.on('close', ...) handler. */ + stream.session.socket.on('close', () => { + this.endCall({code: Status.UNAVAILABLE, details: 'Connection dropped', metadata: new Metadata()}); + }); if (!this.pendingRead) { stream.pause(); } diff --git a/packages/grpc-js/test/test-call-stream.ts b/packages/grpc-js/test/test-call-stream.ts index a85366c7..e2fa43f3 100644 --- a/packages/grpc-js/test/test-call-stream.ts +++ b/packages/grpc-js/test/test-call-stream.ts @@ -30,6 +30,7 @@ import { FilterStackFactory } from '../src/filter-stack'; import { Metadata } from '../src/metadata'; import { assert2, mockFunction } from './common'; +import { EventEmitter } from 'events'; interface DataFrames { payload: Buffer; @@ -69,7 +70,7 @@ class ClientHttp2StreamMock extends stream.Duplex readonly sentInfoHeaders?: OutgoingHttpHeaders[] = []; readonly sentTrailers?: OutgoingHttpHeaders = undefined; // tslint:disable:no-any - session: http2.Http2Session = {} as any; + session: http2.Http2Session = {socket: new EventEmitter()} as any; state: http2.StreamState = {} as any; // tslint:enable:no-any close = mockFunction; From c8fe8f0c9c3c44c91b2f861ed052f1b96da5533c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 9 Sep 2019 15:28:16 -0700 Subject: [PATCH 29/38] Add logging for (de)serialization errors --- packages/grpc-native-core/src/client_interceptors.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/grpc-native-core/src/client_interceptors.js b/packages/grpc-native-core/src/client_interceptors.js index 2fe373f3..2cf48481 100644 --- a/packages/grpc-native-core/src/client_interceptors.js +++ b/packages/grpc-native-core/src/client_interceptors.js @@ -688,6 +688,7 @@ function _getStreamReadCallback(emitter, call, get_listener, deserialize) { try { deserialized = deserialize(data); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`); emitter._readsDone({ code: constants.status.INTERNAL, details: 'Failed to parse server response' @@ -829,6 +830,7 @@ function _getUnaryInterceptor(method_definition, channel, emitter, callback) { try { deserialized = deserialize(response.read); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`); /* Change status to indicate bad server response. This * will result in passing an error to the callback */ status = { @@ -909,6 +911,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter, try { deserialized = deserialize(response.read); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`); /* Change status to indicate bad server response. This will result * in passing an error to the callback */ status = { @@ -933,6 +936,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter, try { message = serialize(chunk); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`); /* Sending this error to the server and emitting it immediately on the client may put the call in a slightly weird state on the client side, but passing an object that causes a serialization failure is a misuse @@ -1134,6 +1138,7 @@ function _getBidiStreamingInterceptor(method_definition, channel, emitter) { try { message = serialize(chunk); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`); /* Sending this error to the server and emitting it immediately on the client may put the call in a slightly weird state on the client side, but passing an object that causes a serialization failure is a misuse From 8900aab94e1153542d8b81f62e158e3389adda4f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 10 Sep 2019 12:49:15 -0700 Subject: [PATCH 30/38] Bump grpc-js to 0.5.3 --- packages/grpc-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 51ff1cfd..893fd46d 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "0.5.2", + "version": "0.5.3", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", From a8f219fad5722d708b77f39778622790500fd2ef Mon Sep 17 00:00:00 2001 From: Teju Nareddy Date: Wed, 11 Sep 2019 12:15:49 -0700 Subject: [PATCH 31/38] Add documentation for `grpc-health-check` Signed-off-by: Teju Nareddy --- packages/grpc-health-check/README.md | 91 +++++++++++++++++++++++++ packages/grpc-health-check/package.json | 5 +- 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 packages/grpc-health-check/README.md diff --git a/packages/grpc-health-check/README.md b/packages/grpc-health-check/README.md new file mode 100644 index 00000000..6484ac0a --- /dev/null +++ b/packages/grpc-health-check/README.md @@ -0,0 +1,91 @@ +# grpc-health-check + +Health check client and service for use with gRPC-node. + +## Background + +This package exports both a client and server that adhere to the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + +By using this package, clients and servers can rely on common proto and service definitions. This means: +- Clients can use the generated stubs to health check _any_ server that adheres to the protocol. +- Servers do not reimplement common logic for publishing health statuses. + +## Installation + +Use the package manager [npm](https://www.npmjs.com/get-npm) to install `grpc-health-check`. + +```bash +npm install grpc-health-check +``` + +## Usage + +### Server + +Any gRPC-node server can use `grpc-health-check` to adhere to the gRPC Health Checking Protocol. +The following shows how this package can be added to a pre-existing gRPC server. + +```javascript 1.8 +// Import package +let health = require('grpc-health-check'); + +// Define service status map. Key is the service name, value is the corresponding status. +// By convention, the empty string "" key represents that status of the entire server. +const statusMap = { + "ServiceFoo": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.SERVING, + "ServiceBar": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.NOT_SERVING, + "": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.NOT_SERVING, +}; + +// Construct the service implementation +let healthImpl = new health.Implementation(statusMap); + +// Add the service and implementation to your pre-existing gRPC-node server +server.addService(health.service, healthImpl); +``` + +Congrats! Your server now allows any client to run a health check against it. + +### Client + +Any gRPC-node client can use `grpc-health-check` to run health checks against other servers that follow the protocol. +The following shows how this package can be used by a pre-existing gRPC client. + +```javascript 1.8 +// Import package +let grpc = require('grpc'); +let health = require('grpc-health-check'); + +// Create the client +let healthClient = new health.Client('localhost:8082', grpc.credentials.createInsecure()); + +// Define the request, which contains the service to health check +// By convention, the empty string "" key represents that status of the entire server. +let request = { + service: "", +}; + +// Define the callback +function callback (error, status) { + if (error) { + console.error(error); + return; + } + + console.log(status); +} + +// Make the request +healthClient.check(request, callback); +``` + +This should print out "NOT_SERVING" if used with the server above. + +## Contributing + +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. + +Please make sure to update tests as appropriate. + +## License +[Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/) diff --git a/packages/grpc-health-check/package.json b/packages/grpc-health-check/package.json index e10de7c1..388eb7d8 100644 --- a/packages/grpc-health-check/package.json +++ b/packages/grpc-health-check/package.json @@ -1,8 +1,8 @@ { "name": "grpc-health-check", - "version": "1.7.0", + "version": "1.7.1", "author": "Google Inc.", - "description": "Health check service for use with gRPC", + "description": "Health check client and service for use with gRPC-node", "repository": { "type": "git", "url": "https://github.com/grpc/grpc-node.git" @@ -22,6 +22,7 @@ }, "files": [ "LICENSE", + "README.md", "health.js", "v1" ], From 0e37241a512a88864b9c90e717c8c78f861815e3 Mon Sep 17 00:00:00 2001 From: Teju Nareddy Date: Wed, 11 Sep 2019 13:21:05 -0700 Subject: [PATCH 32/38] Omit client code due to bug in package. Will re-add once package is updated. Signed-off-by: Teju Nareddy --- packages/grpc-health-check/README.md | 31 ---------------------------- 1 file changed, 31 deletions(-) diff --git a/packages/grpc-health-check/README.md b/packages/grpc-health-check/README.md index 6484ac0a..62a88347 100644 --- a/packages/grpc-health-check/README.md +++ b/packages/grpc-health-check/README.md @@ -49,37 +49,6 @@ Congrats! Your server now allows any client to run a health check against it. ### Client Any gRPC-node client can use `grpc-health-check` to run health checks against other servers that follow the protocol. -The following shows how this package can be used by a pre-existing gRPC client. - -```javascript 1.8 -// Import package -let grpc = require('grpc'); -let health = require('grpc-health-check'); - -// Create the client -let healthClient = new health.Client('localhost:8082', grpc.credentials.createInsecure()); - -// Define the request, which contains the service to health check -// By convention, the empty string "" key represents that status of the entire server. -let request = { - service: "", -}; - -// Define the callback -function callback (error, status) { - if (error) { - console.error(error); - return; - } - - console.log(status); -} - -// Make the request -healthClient.check(request, callback); -``` - -This should print out "NOT_SERVING" if used with the server above. ## Contributing From 9114f34ea3cd8315f3531a9b452a4c02761d4399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?GP=20=E2=9C=85?= Date: Thu, 12 Sep 2019 09:37:00 +0530 Subject: [PATCH 33/38] Fix #502 - Make all properties of CallOptions optional --- packages/grpc-native-core/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grpc-native-core/index.d.ts b/packages/grpc-native-core/index.d.ts index c7dab49d..924d0730 100644 --- a/packages/grpc-native-core/index.d.ts +++ b/packages/grpc-native-core/index.d.ts @@ -1198,11 +1198,11 @@ declare module "grpc" { * Indicates which properties of a parent call should propagate to this * call. Bitwise combination of flags in `grpc.propagate`. */ - propagate_flags: number; + propagate_flags?: number; /** * The credentials that should be used to make this particular call. */ - credentials: CallCredentials; + credentials?: CallCredentials; /** * Additional custom call options. These can be used to pass additional * data per-call to client interceptors From fc032c0226b4e6375c448c06b3394623e08d7086 Mon Sep 17 00:00:00 2001 From: Bjorn Stromberg Date: Fri, 13 Sep 2019 12:31:33 +0900 Subject: [PATCH 34/38] grpc-js: Update gts and apply fixes --- packages/grpc-js/package.json | 2 +- packages/grpc-js/src/call-stream.ts | 14 +++++++++----- packages/grpc-js/src/index.ts | 15 ++++++++++++--- packages/grpc-js/src/server-call.ts | 23 ++++++++++++++--------- packages/grpc-js/src/server.ts | 5 ++++- packages/grpc-js/test/test-call-stream.ts | 2 +- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 893fd46d..a9c5c253 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -26,7 +26,7 @@ "@types/semver": "^6.0.1", "clang-format": "^1.0.55", "execa": "^2.0.3", - "gts": "^1.0.0", + "gts": "^1.1.0", "gulp": "^4.0.2", "gulp-mocha": "^6.0.0", "lodash": "^4.17.4", diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index d04eb9b6..74442e7a 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -343,12 +343,16 @@ export class Http2CallStream extends Duplex implements Call { * "close" events, where we will handle the error more granularly */ }); /* If the underlying TLS or TCP connection closes, we want to end the - * call with an UNAVAILABLE status to match the behavior of the other - * library. In this handler we don't wait for trailers before ending the - * call. This should ensure that this endCall happens sooner than the one - * in the stream.on('close', ...) handler. */ + * call with an UNAVAILABLE status to match the behavior of the other + * library. In this handler we don't wait for trailers before ending the + * call. This should ensure that this endCall happens sooner than the one + * in the stream.on('close', ...) handler. */ stream.session.socket.on('close', () => { - this.endCall({code: Status.UNAVAILABLE, details: 'Connection dropped', metadata: new Metadata()}); + this.endCall({ + code: Status.UNAVAILABLE, + details: 'Connection dropped', + metadata: new Metadata(), + }); }); if (!this.pendingRead) { stream.pause(); diff --git a/packages/grpc-js/src/index.ts b/packages/grpc-js/src/index.ts index 8c5851bf..b7ce2e0d 100644 --- a/packages/grpc-js/src/index.ts +++ b/packages/grpc-js/src/index.ts @@ -38,10 +38,19 @@ import { Serialize, } from './make-client'; import { Metadata } from './metadata'; -import { Server, UntypedHandleCall, UntypedServiceImplementation } from './server'; +import { + Server, + UntypedHandleCall, + UntypedServiceImplementation, +} from './server'; import { KeyCertPair, ServerCredentials } from './server-credentials'; import { StatusBuilder } from './status-builder'; -import { ServerUnaryCall, ServerReadableStream, ServerWritableStream, ServerDuplexStream } from './server-call'; +import { + ServerUnaryCall, + ServerReadableStream, + ServerWritableStream, + ServerDuplexStream, +} from './server-call'; const supportedNodeVersions = require('../../package.json').engines.node; if (!semver.satisfies(process.version, supportedNodeVersions)) { @@ -219,7 +228,7 @@ export { ServerWritableStream, ServerDuplexStream, UntypedHandleCall, - UntypedServiceImplementation + UntypedServiceImplementation, }; /* tslint:disable:no-any */ diff --git a/packages/grpc-js/src/server-call.ts b/packages/grpc-js/src/server-call.ts index c9a6b3f7..02353bbe 100644 --- a/packages/grpc-js/src/server-call.ts +++ b/packages/grpc-js/src/server-call.ts @@ -76,9 +76,11 @@ export type ServerReadableStream< export type ServerWritableStream< RequestType, ResponseType -> = ServerSurfaceCall & ObjectWritable & { request: RequestType | null }; +> = ServerSurfaceCall & + ObjectWritable & { request: RequestType | null }; export type ServerDuplexStream = ServerSurfaceCall & - ObjectReadable & ObjectWritable; + ObjectReadable & + ObjectWritable; export class ServerUnaryCallImpl extends EventEmitter implements ServerUnaryCall { @@ -497,15 +499,18 @@ export class Http2ServerCallStream< sendError(error: ServerErrorResponse | ServerStatusResponse) { const status: StatusObject = { code: Status.UNKNOWN, - details: ('message' in error) - ? error.message - : 'Unknown Error', - metadata: ('metadata' in error && error.metadata !== undefined) - ? error.metadata - : new Metadata(), + details: 'message' in error ? error.message : 'Unknown Error', + metadata: + 'metadata' in error && error.metadata !== undefined + ? error.metadata + : new Metadata(), }; - if ('code' in error && typeof error.code === 'number' && Number.isInteger(error.code)) { + if ( + 'code' in error && + typeof error.code === 'number' && + Number.isInteger(error.code) + ) { status.code = error.code; if ('details' in error && typeof error.details === 'string') { diff --git a/packages/grpc-js/src/server.ts b/packages/grpc-js/src/server.ts index a568f9c1..780b8f86 100644 --- a/packages/grpc-js/src/server.ts +++ b/packages/grpc-js/src/server.ts @@ -102,7 +102,10 @@ export class Server { throw new Error('Not implemented. Use addService() instead'); } - addService(service: ServiceDefinition, implementation: UntypedServiceImplementation): void { + addService( + service: ServiceDefinition, + implementation: UntypedServiceImplementation + ): void { if (this.started === true) { throw new Error("Can't add a service to a started server."); } diff --git a/packages/grpc-js/test/test-call-stream.ts b/packages/grpc-js/test/test-call-stream.ts index e2fa43f3..cd51674d 100644 --- a/packages/grpc-js/test/test-call-stream.ts +++ b/packages/grpc-js/test/test-call-stream.ts @@ -70,7 +70,7 @@ class ClientHttp2StreamMock extends stream.Duplex readonly sentInfoHeaders?: OutgoingHttpHeaders[] = []; readonly sentTrailers?: OutgoingHttpHeaders = undefined; // tslint:disable:no-any - session: http2.Http2Session = {socket: new EventEmitter()} as any; + session: http2.Http2Session = { socket: new EventEmitter() } as any; state: http2.StreamState = {} as any; // tslint:enable:no-any close = mockFunction; From 50f69945105e4b635338336ad6a7d8bd172bec33 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 13 Sep 2019 19:49:42 +0200 Subject: [PATCH 35/38] Update master to 1.24. --- packages/grpc-native-core/binding.gyp | 90 +++++++++++++++++--------- packages/grpc-native-core/deps/grpc | 2 +- packages/grpc-native-core/package.json | 2 +- 3 files changed, 60 insertions(+), 34 deletions(-) diff --git a/packages/grpc-native-core/binding.gyp b/packages/grpc-native-core/binding.gyp index 6dae2c5b..b32d9836 100644 --- a/packages/grpc-native-core/binding.gyp +++ b/packages/grpc-native-core/binding.gyp @@ -60,13 +60,9 @@ '-g', '-Wall', '-Wextra', - '-Werror', - '-Wno-long-long', - '-Wno-unused-parameter', '-DOSATOMIC_USE_INLINED=1', - '-Wno-deprecated-declarations', - '-Ithird_party/nanopb', - '-DPB_FIELD_32BIT', + '-Ithird_party/upb', + '-Isrc/core/ext/upb-generated', '-fvisibility=hidden', ], 'ldflags': [ @@ -97,7 +93,7 @@ 'GPR_BACKWARDS_COMPATIBILITY_MODE', 'GRPC_ARES=1', 'GRPC_UV', - 'GRPC_NODE_VERSION="1.22.0-pre1"', + 'GRPC_NODE_VERSION="1.24.0-pre1"', 'CARES_STATICLIB', 'CARES_SYMBOL_HIDING' ], @@ -193,26 +189,18 @@ '-g', '-Wall', '-Wextra', - '-Werror', - '-Wno-long-long', - '-Wno-unused-parameter', '-DOSATOMIC_USE_INLINED=1', - '-Wno-deprecated-declarations', - '-Ithird_party/nanopb', - '-DPB_FIELD_32BIT', + '-Ithird_party/upb', + '-Isrc/core/ext/upb-generated', '-fvisibility=hidden', ], 'OTHER_CPLUSPLUSFLAGS': [ '-g', '-Wall', '-Wextra', - '-Werror', - '-Wno-long-long', - '-Wno-unused-parameter', '-DOSATOMIC_USE_INLINED=1', - '-Wno-deprecated-declarations', - '-Ithird_party/nanopb', - '-DPB_FIELD_32BIT', + '-Ithird_party/upb', + '-Isrc/core/ext/upb-generated', '-fvisibility=hidden', '-stdlib=libc++', '-std=c++1y', @@ -691,7 +679,6 @@ 'deps/grpc/src/core/lib/gpr/env_linux.cc', 'deps/grpc/src/core/lib/gpr/env_posix.cc', 'deps/grpc/src/core/lib/gpr/env_windows.cc', - 'deps/grpc/src/core/lib/gpr/host_port.cc', 'deps/grpc/src/core/lib/gpr/log.cc', 'deps/grpc/src/core/lib/gpr/log_android.cc', 'deps/grpc/src/core/lib/gpr/log_linux.cc', @@ -718,6 +705,7 @@ 'deps/grpc/src/core/lib/gprpp/arena.cc', 'deps/grpc/src/core/lib/gprpp/fork.cc', 'deps/grpc/src/core/lib/gprpp/global_config_env.cc', + 'deps/grpc/src/core/lib/gprpp/host_port.cc', 'deps/grpc/src/core/lib/gprpp/thd_posix.cc', 'deps/grpc/src/core/lib/gprpp/thd_windows.cc', 'deps/grpc/src/core/lib/profiling/basic_timers.cc', @@ -782,6 +770,8 @@ 'deps/grpc/src/core/lib/iomgr/ev_windows.cc', 'deps/grpc/src/core/lib/iomgr/exec_ctx.cc', 'deps/grpc/src/core/lib/iomgr/executor.cc', + 'deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.cc', + 'deps/grpc/src/core/lib/iomgr/executor/threadpool.cc', 'deps/grpc/src/core/lib/iomgr/fork_posix.cc', 'deps/grpc/src/core/lib/iomgr/fork_windows.cc', 'deps/grpc/src/core/lib/iomgr/gethostname_fallback.cc', @@ -952,6 +942,7 @@ 'deps/grpc/src/core/lib/security/security_connector/security_connector.cc', 'deps/grpc/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc', 'deps/grpc/src/core/lib/security/security_connector/ssl_utils.cc', + 'deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.cc', 'deps/grpc/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc', 'deps/grpc/src/core/lib/security/transport/client_auth_filter.cc', 'deps/grpc/src/core/lib/security/transport/secure_endpoint.cc', @@ -985,21 +976,23 @@ 'deps/grpc/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc', 'deps/grpc/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc', 'deps/grpc/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc', - 'deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc', - 'deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc', 'deps/grpc/src/core/tsi/alts/handshaker/alts_tsi_utils.cc', 'deps/grpc/src/core/tsi/alts/handshaker/transport_security_common_api.cc', - 'deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.c', - 'deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.c', - 'deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.c', - 'deps/grpc/third_party/nanopb/pb_common.c', - 'deps/grpc/third_party/nanopb/pb_decode.c', - 'deps/grpc/third_party/nanopb/pb_encode.c', + 'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', + 'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', + 'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', + 'deps/grpc/third_party/upb/upb/decode.c', + 'deps/grpc/third_party/upb/upb/encode.c', + 'deps/grpc/third_party/upb/upb/msg.c', + 'deps/grpc/third_party/upb/upb/port.c', + 'deps/grpc/third_party/upb/upb/table.c', + 'deps/grpc/third_party/upb/upb/upb.c', 'deps/grpc/src/core/tsi/transport_security.cc', 'deps/grpc/src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'deps/grpc/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'deps/grpc/src/core/ext/transport/chttp2/client/authority.cc', 'deps/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'deps/grpc/src/core/ext/filters/client_channel/backend_metric.cc', 'deps/grpc/src/core/ext/filters/client_channel/backup_poller.cc', 'deps/grpc/src/core/ext/filters/client_channel/channel_connectivity.cc', 'deps/grpc/src/core/ext/filters/client_channel/client_channel.cc', @@ -1027,7 +1020,20 @@ 'deps/grpc/src/core/ext/filters/client_channel/subchannel.cc', 'deps/grpc/src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'deps/grpc/src/core/ext/filters/deadline/deadline_filter.cc', - 'deps/grpc/src/core/ext/filters/client_channel/health/health.pb.c', + 'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'deps/grpc/src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'deps/grpc/src/core/ext/upb-generated/validate/validate.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/api/annotations.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/api/http.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'deps/grpc/src/core/ext/upb-generated/google/rpc/status.upb.c', 'deps/grpc/src/core/tsi/fake_transport_security.cc', 'deps/grpc/src/core/tsi/local_transport_security.cc', 'deps/grpc/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', @@ -1046,14 +1052,32 @@ 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', 'deps/grpc/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', - 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/type/percent.upb.c', + 'deps/grpc/src/core/ext/upb-generated/envoy/type/range.upb.c', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'deps/grpc/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1069,7 +1093,9 @@ 'deps/grpc/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc', 'deps/grpc/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'deps/grpc/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', + 'deps/grpc/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc', 'deps/grpc/src/core/ext/filters/census/grpc_context.cc', + 'deps/grpc/src/core/ext/filters/client_idle/client_idle_filter.cc', 'deps/grpc/src/core/ext/filters/max_age/max_age_filter.cc', 'deps/grpc/src/core/ext/filters/message_size/message_size_filter.cc', 'deps/grpc/src/core/ext/filters/http/client_authority_filter.cc', diff --git a/packages/grpc-native-core/deps/grpc b/packages/grpc-native-core/deps/grpc index 35230ef8..f703e1c8 160000 --- a/packages/grpc-native-core/deps/grpc +++ b/packages/grpc-native-core/deps/grpc @@ -1 +1 @@ -Subproject commit 35230ef8cd70d62ab94bee661b7cd641adfa805b +Subproject commit f703e1c86c1504d9e48953f8da31f842679b7775 diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 4605eb2a..e9e756bd 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.22.0-pre1", + "version": "1.24.0-pre1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", From b847e405e80990bf1b73fe30a9f6a9594671ff35 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 17 Sep 2019 23:07:39 +0200 Subject: [PATCH 36/38] Also tweaking local template. --- packages/grpc-native-core/binding.gyp | 2 -- packages/grpc-native-core/templates/binding.gyp.template | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/grpc-native-core/binding.gyp b/packages/grpc-native-core/binding.gyp index b32d9836..8dda8422 100644 --- a/packages/grpc-native-core/binding.gyp +++ b/packages/grpc-native-core/binding.gyp @@ -69,11 +69,9 @@ '-g', ], 'cflags_c': [ - '-Werror', '-std=c99' ], 'cflags_cc': [ - '-Werror', '-std=c++1y' ], 'include_dirs': [ diff --git a/packages/grpc-native-core/templates/binding.gyp.template b/packages/grpc-native-core/templates/binding.gyp.template index cdf1a1a0..1d9f07fc 100644 --- a/packages/grpc-native-core/templates/binding.gyp.template +++ b/packages/grpc-native-core/templates/binding.gyp.template @@ -65,11 +65,9 @@ % endif % endfor 'cflags_c': [ - '-Werror', '-std=c99' ], 'cflags_cc': [ - '-Werror', '-std=c++1y' ], 'include_dirs': [ From 9e2aea039956a050882501260b8239c94ad43702 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Sep 2019 14:42:40 -0700 Subject: [PATCH 37/38] Revert "Add specific call error for TCP disconnection" --- packages/grpc-js/src/call-stream.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index 74442e7a..2f2c35b0 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -342,18 +342,6 @@ export class Http2CallStream extends Duplex implements Call { * from bubbling up. However, errors here should all correspond to * "close" events, where we will handle the error more granularly */ }); - /* If the underlying TLS or TCP connection closes, we want to end the - * call with an UNAVAILABLE status to match the behavior of the other - * library. In this handler we don't wait for trailers before ending the - * call. This should ensure that this endCall happens sooner than the one - * in the stream.on('close', ...) handler. */ - stream.session.socket.on('close', () => { - this.endCall({ - code: Status.UNAVAILABLE, - details: 'Connection dropped', - metadata: new Metadata(), - }); - }); if (!this.pendingRead) { stream.pause(); } From 96db88a3fb504a8ad9666d4a8a05ab33ac2f6db3 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 20 Sep 2019 10:44:13 -0700 Subject: [PATCH 38/38] Bump grpc-js to 0.5.4 --- packages/grpc-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index a9c5c253..193a4d76 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "0.5.3", + "version": "0.5.4", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",