Skip to content

Commit 6b036f3

Browse files
authored
Merge pull request #2505 from murgatroid99/v1.18.x_upmerge
Merge v1.18.x into master (with formatting fixes)
2 parents 9ce6e49 + 66bcc7a commit 6b036f3

29 files changed

+143
-141
lines changed

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.8.14",
3+
"version": "1.8.18",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/channel-credentials.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ export type CheckServerIdentityCallback = (
4343
cert: PeerCertificate
4444
) => Error | undefined;
4545

46-
function bufferOrNullEqual(buf1: Buffer | null, buf2: Buffer | null) {
47-
if (buf1 === null && buf2 === null) {
48-
return true;
49-
} else {
50-
return buf1 !== null && buf2 !== null && buf1.equals(buf2);
51-
}
52-
}
53-
5446
/**
5547
* Additional peer verification options that can be set when creating
5648
* SSL credentials.

packages/grpc-js/src/client-interceptors.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
import { Status } from './constants';
3333
import { Channel } from './channel';
3434
import { CallOptions } from './client';
35-
import { CallCredentials } from './call-credentials';
3635
import { ClientMethodDefinition } from './make-client';
3736
import { getErrorMessage } from './error';
3837

packages/grpc-js/src/client.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export class Client {
322322
emitter.call = call;
323323
let responseMessage: ResponseType | null = null;
324324
let receivedStatus = false;
325-
const callerStackError = new Error();
325+
let callerStackError: Error | null = new Error();
326326
call.start(callProperties.metadata, {
327327
onReceiveMetadata: metadata => {
328328
emitter.emit('metadata', metadata);
@@ -341,7 +341,7 @@ export class Client {
341341
receivedStatus = true;
342342
if (status.code === Status.OK) {
343343
if (responseMessage === null) {
344-
const callerStack = getErrorStackString(callerStackError);
344+
const callerStack = getErrorStackString(callerStackError!);
345345
callProperties.callback!(
346346
callErrorFromStatus(
347347
{
@@ -356,9 +356,12 @@ export class Client {
356356
callProperties.callback!(null, responseMessage);
357357
}
358358
} else {
359-
const callerStack = getErrorStackString(callerStackError);
359+
const callerStack = getErrorStackString(callerStackError!);
360360
callProperties.callback!(callErrorFromStatus(status, callerStack));
361361
}
362+
/* Avoid retaining the callerStackError object in the call context of
363+
* the status event handler. */
364+
callerStackError = null;
362365
emitter.emit('status', status);
363366
},
364367
});
@@ -452,7 +455,7 @@ export class Client {
452455
emitter.call = call;
453456
let responseMessage: ResponseType | null = null;
454457
let receivedStatus = false;
455-
const callerStackError = new Error();
458+
let callerStackError: Error | null = new Error();
456459
call.start(callProperties.metadata, {
457460
onReceiveMetadata: metadata => {
458461
emitter.emit('metadata', metadata);
@@ -471,7 +474,7 @@ export class Client {
471474
receivedStatus = true;
472475
if (status.code === Status.OK) {
473476
if (responseMessage === null) {
474-
const callerStack = getErrorStackString(callerStackError);
477+
const callerStack = getErrorStackString(callerStackError!);
475478
callProperties.callback!(
476479
callErrorFromStatus(
477480
{
@@ -486,9 +489,12 @@ export class Client {
486489
callProperties.callback!(null, responseMessage);
487490
}
488491
} else {
489-
const callerStack = getErrorStackString(callerStackError);
492+
const callerStack = getErrorStackString(callerStackError!);
490493
callProperties.callback!(callErrorFromStatus(status, callerStack));
491494
}
495+
/* Avoid retaining the callerStackError object in the call context of
496+
* the status event handler. */
497+
callerStackError = null;
492498
emitter.emit('status', status);
493499
},
494500
});
@@ -585,7 +591,7 @@ export class Client {
585591
* call after that. */
586592
stream.call = call;
587593
let receivedStatus = false;
588-
const callerStackError = new Error();
594+
let callerStackError: Error | null = new Error();
589595
call.start(callProperties.metadata, {
590596
onReceiveMetadata(metadata: Metadata) {
591597
stream.emit('metadata', metadata);
@@ -601,9 +607,12 @@ export class Client {
601607
receivedStatus = true;
602608
stream.push(null);
603609
if (status.code !== Status.OK) {
604-
const callerStack = getErrorStackString(callerStackError);
610+
const callerStack = getErrorStackString(callerStackError!);
605611
stream.emit('error', callErrorFromStatus(status, callerStack));
606612
}
613+
/* Avoid retaining the callerStackError object in the call context of
614+
* the status event handler. */
615+
callerStackError = null;
607616
stream.emit('status', status);
608617
},
609618
});
@@ -677,7 +686,7 @@ export class Client {
677686
* call after that. */
678687
stream.call = call;
679688
let receivedStatus = false;
680-
const callerStackError = new Error();
689+
let callerStackError: Error | null = new Error();
681690
call.start(callProperties.metadata, {
682691
onReceiveMetadata(metadata: Metadata) {
683692
stream.emit('metadata', metadata);
@@ -692,9 +701,12 @@ export class Client {
692701
receivedStatus = true;
693702
stream.push(null);
694703
if (status.code !== Status.OK) {
695-
const callerStack = getErrorStackString(callerStackError);
704+
const callerStack = getErrorStackString(callerStackError!);
696705
stream.emit('error', callErrorFromStatus(status, callerStack));
697706
}
707+
/* Avoid retaining the callerStackError object in the call context of
708+
* the status event handler. */
709+
callerStackError = null;
698710
stream.emit('status', status);
699711
},
700712
});

packages/grpc-js/src/compression-filter.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,7 @@ export class CompressionFilterFactory
308308
implements FilterFactory<CompressionFilter>
309309
{
310310
private sharedFilterConfig: SharedCompressionFilterConfig = {};
311-
constructor(
312-
private readonly channel: Channel,
313-
private readonly options: ChannelOptions
314-
) {}
311+
constructor(channel: Channel, private readonly options: ChannelOptions) {}
315312
createFilter(): CompressionFilter {
316313
return new CompressionFilter(this.options, this.sharedFilterConfig);
317314
}

packages/grpc-js/src/generated/grpc/channelz/v1/ChannelConnectivityState.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,43 @@
33

44
// Original file: proto/channelz.proto
55

6-
export enum _grpc_channelz_v1_ChannelConnectivityState_State {
7-
UNKNOWN = 0,
8-
IDLE = 1,
9-
CONNECTING = 2,
10-
READY = 3,
11-
TRANSIENT_FAILURE = 4,
12-
SHUTDOWN = 5,
13-
}
6+
export const _grpc_channelz_v1_ChannelConnectivityState_State = {
7+
UNKNOWN: 'UNKNOWN',
8+
IDLE: 'IDLE',
9+
CONNECTING: 'CONNECTING',
10+
READY: 'READY',
11+
TRANSIENT_FAILURE: 'TRANSIENT_FAILURE',
12+
SHUTDOWN: 'SHUTDOWN',
13+
} as const;
14+
15+
export type _grpc_channelz_v1_ChannelConnectivityState_State =
16+
| 'UNKNOWN'
17+
| 0
18+
| 'IDLE'
19+
| 1
20+
| 'CONNECTING'
21+
| 2
22+
| 'READY'
23+
| 3
24+
| 'TRANSIENT_FAILURE'
25+
| 4
26+
| 'SHUTDOWN'
27+
| 5
28+
29+
export type _grpc_channelz_v1_ChannelConnectivityState_State__Output = typeof _grpc_channelz_v1_ChannelConnectivityState_State[keyof typeof _grpc_channelz_v1_ChannelConnectivityState_State]
1430

1531
/**
1632
* These come from the specified states in this document:
1733
* https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md
1834
*/
1935
export interface ChannelConnectivityState {
20-
'state'?: (_grpc_channelz_v1_ChannelConnectivityState_State | keyof typeof _grpc_channelz_v1_ChannelConnectivityState_State);
36+
'state'?: (_grpc_channelz_v1_ChannelConnectivityState_State);
2137
}
2238

2339
/**
2440
* These come from the specified states in this document:
2541
* https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md
2642
*/
2743
export interface ChannelConnectivityState__Output {
28-
'state': (keyof typeof _grpc_channelz_v1_ChannelConnectivityState_State);
44+
'state': (_grpc_channelz_v1_ChannelConnectivityState_State__Output);
2945
}

packages/grpc-js/src/generated/grpc/channelz/v1/ChannelTraceEvent.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,30 @@ import type { SubchannelRef as _grpc_channelz_v1_SubchannelRef, SubchannelRef__O
99
/**
1010
* The supported severity levels of trace events.
1111
*/
12-
export enum _grpc_channelz_v1_ChannelTraceEvent_Severity {
13-
CT_UNKNOWN = 0,
14-
CT_INFO = 1,
15-
CT_WARNING = 2,
16-
CT_ERROR = 3,
17-
}
12+
export const _grpc_channelz_v1_ChannelTraceEvent_Severity = {
13+
CT_UNKNOWN: 'CT_UNKNOWN',
14+
CT_INFO: 'CT_INFO',
15+
CT_WARNING: 'CT_WARNING',
16+
CT_ERROR: 'CT_ERROR',
17+
} as const;
18+
19+
/**
20+
* The supported severity levels of trace events.
21+
*/
22+
export type _grpc_channelz_v1_ChannelTraceEvent_Severity =
23+
| 'CT_UNKNOWN'
24+
| 0
25+
| 'CT_INFO'
26+
| 1
27+
| 'CT_WARNING'
28+
| 2
29+
| 'CT_ERROR'
30+
| 3
31+
32+
/**
33+
* The supported severity levels of trace events.
34+
*/
35+
export type _grpc_channelz_v1_ChannelTraceEvent_Severity__Output = typeof _grpc_channelz_v1_ChannelTraceEvent_Severity[keyof typeof _grpc_channelz_v1_ChannelTraceEvent_Severity]
1836

1937
/**
2038
* A trace event is an interesting thing that happened to a channel or
@@ -28,7 +46,7 @@ export interface ChannelTraceEvent {
2846
/**
2947
* the severity of the trace event
3048
*/
31-
'severity'?: (_grpc_channelz_v1_ChannelTraceEvent_Severity | keyof typeof _grpc_channelz_v1_ChannelTraceEvent_Severity);
49+
'severity'?: (_grpc_channelz_v1_ChannelTraceEvent_Severity);
3250
/**
3351
* When this event occurred.
3452
*/
@@ -56,7 +74,7 @@ export interface ChannelTraceEvent__Output {
5674
/**
5775
* the severity of the trace event
5876
*/
59-
'severity': (keyof typeof _grpc_channelz_v1_ChannelTraceEvent_Severity);
77+
'severity': (_grpc_channelz_v1_ChannelTraceEvent_Severity__Output);
6078
/**
6179
* When this event occurred.
6280
*/

packages/grpc-js/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ import {
4343
loadPackageDefinition,
4444
makeClientConstructor,
4545
MethodDefinition,
46-
ProtobufTypeDefinition,
4746
Serialize,
48-
ServiceClientConstructor,
4947
ServiceDefinition,
5048
} from './make-client';
5149
import { Metadata, MetadataOptions, MetadataValue } from './metadata';

packages/grpc-js/src/internal-channel.ts

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ import { ChannelOptions } from './channel-options';
2020
import { ResolvingLoadBalancer } from './resolving-load-balancer';
2121
import { SubchannelPool, getSubchannelPool } from './subchannel-pool';
2222
import { ChannelControlHelper } from './load-balancer';
23-
import {
24-
UnavailablePicker,
25-
Picker,
26-
PickResultType,
27-
QueuePicker,
28-
} from './picker';
23+
import { UnavailablePicker, Picker, QueuePicker } from './picker';
2924
import { Metadata } from './metadata';
3025
import { Status, LogVerbosity, Propagate } from './constants';
3126
import { FilterStackFactory } from './filter-stack';
@@ -36,13 +31,12 @@ import {
3631
getDefaultAuthority,
3732
mapUriDefaultScheme,
3833
} from './resolver';
39-
import { trace, log } from './logging';
34+
import { trace } from './logging';
4035
import { SubchannelAddress } from './subchannel-address';
4136
import { MaxMessageSizeFilterFactory } from './max-message-size-filter';
4237
import { mapProxyName } from './http_proxy';
43-
import { GrpcUri, parseUri, splitHostPort, uriToString } from './uri-parser';
38+
import { GrpcUri, parseUri, uriToString } from './uri-parser';
4439
import { ServerSurfaceCall } from './server-call';
45-
import { Filter } from './filter';
4640

4741
import { ConnectivityState } from './connectivity-state';
4842
import {
@@ -55,22 +49,10 @@ import {
5549
SubchannelRef,
5650
unregisterChannelzRef,
5751
} from './channelz';
58-
import { Subchannel } from './subchannel';
5952
import { LoadBalancingCall } from './load-balancing-call';
6053
import { CallCredentials } from './call-credentials';
61-
import {
62-
Call,
63-
CallStreamOptions,
64-
InterceptingListener,
65-
MessageContext,
66-
StatusObject,
67-
} from './call-interface';
68-
import { SubchannelCall } from './subchannel-call';
69-
import {
70-
Deadline,
71-
deadlineToString,
72-
getDeadlineTimeoutString,
73-
} from './deadline';
54+
import { Call, CallStreamOptions, StatusObject } from './call-interface';
55+
import { Deadline, deadlineToString } from './deadline';
7456
import { ResolvingCall } from './resolving-call';
7557
import { getNextCallNumber } from './call-number';
7658
import { restrictControlPlaneStatusCode } from './control-plane-status';

packages/grpc-js/src/load-balancer-outlier-detection.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,14 @@ import {
2424
createChildChannelControlHelper,
2525
registerLoadBalancerType,
2626
} from './experimental';
27-
import { BaseFilter, Filter, FilterFactory } from './filter';
2827
import {
2928
getFirstUsableConfig,
3029
LoadBalancer,
3130
LoadBalancingConfig,
3231
validateLoadBalancingConfig,
3332
} from './load-balancer';
3433
import { ChildLoadBalancerHandler } from './load-balancer-child-handler';
35-
import {
36-
PickArgs,
37-
Picker,
38-
PickResult,
39-
PickResultType,
40-
QueuePicker,
41-
UnavailablePicker,
42-
} from './picker';
43-
import { Subchannel } from './subchannel';
34+
import { PickArgs, Picker, PickResult, PickResultType } from './picker';
4435
import {
4536
SubchannelAddress,
4637
subchannelAddressToString,
@@ -174,6 +165,14 @@ export class OutlierDetectionLoadBalancingConfig
174165
failurePercentageEjection: Partial<FailurePercentageEjectionConfig> | null,
175166
private readonly childPolicy: LoadBalancingConfig[]
176167
) {
168+
if (
169+
childPolicy.length > 0 &&
170+
childPolicy[0].getLoadBalancerName() === 'pick_first'
171+
) {
172+
throw new Error(
173+
'outlier_detection LB policy cannot have a pick_first child policy'
174+
);
175+
}
177176
this.intervalMs = intervalMs ?? 10_000;
178177
this.baseEjectionTimeMs = baseEjectionTimeMs ?? 30_000;
179178
this.maxEjectionTimeMs = maxEjectionTimeMs ?? 300_000;

0 commit comments

Comments
 (0)