-
Notifications
You must be signed in to change notification settings - Fork 4k
core,netty: Add server negotiation timeout before client preface #3670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| * @since 1.8.0 | ||
| */ | ||
| @ExperimentalApi // FIXME | ||
| public T negotiationTimeout(long timeout, TimeUnit unit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log a warning when it's unsupported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd either want to throw or do nothing. I'd be fine swapping to throwing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swapped to throwing. Doesn't really change much since all our transports receive an implementation from AbstractServerImplBuilder.
| } | ||
| return new ServerTransportListenerImpl(transport); | ||
| ServerTransportListenerImpl stli = new ServerTransportListenerImpl(transport); | ||
| stli.init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the precise point that protocol negotiation starts, and transportReady the precise point that it ends? InProcessServer also does this? Does it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point a TCP connection has been established, but nothing else. transportReady is called before any RPCs are triggered.
zpencer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with throwing change
|
PTAL In addition to throwing, I renamed to |
| initChannel(new GrpcHttp2ServerHeadersDecoder(GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE)); | ||
|
|
||
| handler().handleProtocolNegotiationCompleted(Attributes.EMPTY); | ||
| verify(transportListener, never()).transportReady(any(Attributes.class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/any/isA/ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're equivalent here. But isA would actually be worse, because if I had the wrong class I could miss callbacks that I wanted to trigger failure. I'm not trying to verify it is an Attributes; I just checking the method which happens to have certain arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this verify checks never(), I should have meant the second verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the second verify would fall into "I'm not trying to verify it is an Attributes".
Negotation is the period between transport creation and ready.
This mirrors the behavior of client-side.
732ec44 to
9d5808b
Compare
The two commits here are easiest to review separately and will be committed separately. The first adds support for a negotiation timeout to core and the second improves transportReady callback placement in Netty so the negotiation timeout applies to more phases.
Before merging I'll reserve an issue for
negotiationTimeout's@ExperimentalApiand update the annotation.