Skip to content

agent: handle initial session message#797

Merged
tonistiigi merged 2 commits intomoby:masterfrom
stevvooe:handle-initial-session-message
Jun 5, 2016
Merged

agent: handle initial session message#797
tonistiigi merged 2 commits intomoby:masterfrom
stevvooe:handle-initial-session-message

Conversation

@stevvooe
Copy link
Copy Markdown
Contributor

@stevvooe stevvooe commented Jun 4, 2016

The role of the session message has expanded greatly in the last week,
including node and networking information. Previously, it was sufficient
to drop the first message and listen for updates. Now, there is critical
bootstrapping data that must be propagated at session startup time.

This change ensures this.

Signed-off-by: Stephen J Day stephen.day@docker.com

cc @mrjana @tonistiigi @aluzzardi

The role of the session message has expanded greatly in the last week,
including node and networking information. Previously, it was sufficient
to drop the first message and listen for updates. Now, there is critical
bootstrapping data that must be propagated at session startup time.

This change ensures this.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Comment thread agent/session.go

func (s *session) handleSessionMessage(ctx context.Context, msg *api.SessionMessage) error {
select {
case s.messages <- msg:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You still need to handle Disconnect message somewhere here don't you?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Odd. That should have been in (*Agent).handleSessionMessage. Looks like it was removed here: 1e193df#diff-6ea70e0a4de93ebcb83000a028edc163L290.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's what I remembered seeing from before but went back and looked there and wasn't there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out. We are removing this field and found a much better way to force disconnect.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok. SGTM

@docker-codecov-bot
Copy link
Copy Markdown

docker-codecov-bot commented Jun 5, 2016

Current coverage is 52.56%

Merging #797 into master will decrease coverage by <.01%

  1. File .../test/deepcopy.pb.go (not in diff) was modified. more
    • Misses -3
    • Partials +1
    • Hits +2
  2. File ...atcher/dispatcher.go was modified. more
@@             master       #797   diff @@
==========================================
  Files            78         78          
  Lines         11544      11542     -2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           6070       6067     -3   
+ Misses         4639       4638     -1   
- Partials        835        837     +2   

Sunburst

Powered by Codecov. Last updated by 95f0c7f...74c5fe9

@mrjana
Copy link
Copy Markdown
Contributor

mrjana commented Jun 5, 2016

LGTM

After some close study of session handling and GRPC, we found it to be
sufficient to close the Server's transport stream to force a
reconnection at the agent-level. Under this realization, we have removed
the `disconnect` field from `api.SessionMessage`.

Connection rebalancing is not yet implemented, but we have confirmed
that the current behavior is sufficient to support in the future without
changes in the agent. The detected connection closer on the client-side
forces GRPC to call into the picker and select a new manager node.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
@stevvooe
Copy link
Copy Markdown
Contributor Author

stevvooe commented Jun 5, 2016

cc @tonistiigi PTAL the disconnect removal.

@tonistiigi
Copy link
Copy Markdown
Member

LGTM

@tonistiigi tonistiigi merged commit 81608cb into moby:master Jun 5, 2016
@stevvooe stevvooe deleted the handle-initial-session-message branch June 5, 2016 01:32
cyli added a commit to cyli/swarmkit that referenced this pull request May 25, 2018
to reconnect.  Just return an error - if an error is returned, the agent
will reconnect anyway - it seems like the transport closing was a way
to convince GRPC's load balancer to start reconnecting automatically.
See moby#797.

Signed-off-by: Ying Li <ying.li@docker.com>
cyli added a commit to cyli/swarmkit that referenced this pull request May 29, 2018
to reconnect.  Just return an error - if an error is returned, the agent
will reconnect anyway - it seems like the transport closing was a way
to convince GRPC's load balancer to start reconnecting automatically.
See moby#797.

Signed-off-by: Ying Li <ying.li@docker.com>
cyli added a commit to cyli/swarmkit that referenced this pull request May 29, 2018
to reconnect.  Just return an error - if an error is returned, the agent
will reconnect anyway - it seems like the transport closing was a way
to convince GRPC's load balancer to start reconnecting automatically.
See moby#797.

Signed-off-by: Ying Li <ying.li@docker.com>
@cyli cyli mentioned this pull request May 29, 2018
thaJeztah pushed a commit to thaJeztah/swarmkit that referenced this pull request Aug 19, 2019
to reconnect.  Just return an error - if an error is returned, the agent
will reconnect anyway - it seems like the transport closing was a way
to convince GRPC's load balancer to start reconnecting automatically.
See moby#797.

Signed-off-by: Ying Li <ying.li@docker.com>
(cherry picked from commit 90418ad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants