Skip to content

Conversation

@ejona86
Copy link
Member

@ejona86 ejona86 commented Nov 6, 2017

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 @ExperimentalApi and update the annotation.

@ejona86 ejona86 added the TODO:release blocker Issue/PR is important enough to delay the release. Removed after release issues resolved label Nov 6, 2017
* @since 1.8.0
*/
@ExperimentalApi // FIXME
public T negotiationTimeout(long timeout, TimeUnit unit) {
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member Author

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();
Copy link
Contributor

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?

Copy link
Member Author

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.

@ejona86 ejona86 added this to the 1.8 milestone Nov 7, 2017
Copy link
Contributor

@zpencer zpencer left a 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

@ejona86
Copy link
Member Author

ejona86 commented Nov 9, 2017

PTAL

In addition to throwing, I renamed to handshakeTimeout to align with c-core.

initChannel(new GrpcHttp2ServerHeadersDecoder(GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE));

handler().handleProtocolNegotiationCompleted(Attributes.EMPTY);
verify(transportListener, never()).transportReady(any(Attributes.class));
Copy link
Contributor

Choose a reason for hiding this comment

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

s/any/isA/ ?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.
@ejona86 ejona86 force-pushed the server-negotiation-timeout branch from 732ec44 to 9d5808b Compare November 10, 2017 00:00
@ejona86 ejona86 added the TODO:backport PR needs to be backported. Removed after backport complete label Nov 10, 2017
@ejona86 ejona86 merged commit 93e89ba into grpc:master Nov 10, 2017
@ejona86 ejona86 deleted the server-negotiation-timeout branch November 10, 2017 18:42
@ejona86 ejona86 removed TODO:release blocker Issue/PR is important enough to delay the release. Removed after release issues resolved TODO:backport PR needs to be backported. Removed after backport complete labels Nov 10, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants