Skip to content

netty,alts: fire initial protocol negotiation event in WBAEH#5893

Merged
carl-mastrangelo merged 2 commits intogrpc:masterfrom
carl-mastrangelo:negoitate
Jun 18, 2019
Merged

netty,alts: fire initial protocol negotiation event in WBAEH#5893
carl-mastrangelo merged 2 commits intogrpc:masterfrom
carl-mastrangelo:negoitate

Conversation

@carl-mastrangelo
Copy link
Copy Markdown
Contributor

This change is needed after trying to use the new style protocol negotiators internally. The problem is that some handlers fire the event in handlerAdded, which is too early. The followup PNE is fired after handlerAdded, which breaks the composibility of the negotiators.

To fix this, this change modifies the negotiation flow. Specifically:

  • Negotiators should NEVER fire a negotiation from handlerAdded, instead they should wait until userEventTriggered
  • Negotiators now do state checking on the PNE. If it is set twice, it fails. If it has not been received when doing the next stage of negotiation, it fails.
  • WBAEH now fires the initial, default event. This is the only handler that can fire it from handlerAdded

The tests updated are ones not using WBAEH (which they probably should). This change ensures attributes aren't lost when doing negotiation.

This change is needed after trying to use the new style protocol negotiators internally.  The problem is that some handlers fire the event in handlerAdded, which is too early.  The followup PNE is fired after handlerAdded, which breaks the composibility of the negotiators.

To fix this, this change modifies the negotiation flow.  Specifically:

* Negotiators should NEVER fire a negotiation from handlerAdded, instead they should wait until userEventTriggered
* Negotiators now do state checking on the PNE.  If it is set twice, it fails.  If it has not been received when doing the next stage of negotiation, it fails.
* WBAEH now fires the initial, default event.  This is the only handler that can fire it from handlerAdded

The tests updated are ones not using WBAEH (which they probably should).  This change ensures attributes aren't lost when doing negotiation.
Copy link
Copy Markdown
Contributor

@creamsoup creamsoup left a comment

Choose a reason for hiding this comment

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

LGTM. we are seeing some common patterns for negotiation handlers, we could have an abstract handler when the pattern is well established.

@carl-mastrangelo carl-mastrangelo merged commit 9c9ca65 into grpc:master Jun 18, 2019
@carl-mastrangelo carl-mastrangelo deleted the negoitate branch June 18, 2019 16:33
carl-mastrangelo added a commit that referenced this pull request Jun 19, 2019
Followup to #5893 which causes a server side hang. This is a hack.
@carl-mastrangelo carl-mastrangelo restored the negoitate branch August 17, 2019 01:12
@lock lock bot locked as resolved and limited conversation to collaborators Nov 15, 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