Skip to content
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

Wait for execution result channel before recving #273

Merged
merged 5 commits into from
May 23, 2021

Conversation

iffyio
Copy link
Collaborator

@iffyio iffyio commented May 21, 2021

If we fail to fetch connect to the xds server on startup, there's
a race between the xds client placing the error on the channel
and the resource manager dropping the receiver due to no longer
being able to receive updates from the client.
If the latter happens first, we get a generic 'channel dropped' error
message instead of the actual error message.

This adds a short sleep before checking the channel for an error message
to give the client enough time to send the error.

Also return a result from main rather than unwrapping. Doesn't change
much beyond the error message being less scarier if it doesn't show
up as a panic.

If we fail to fetch connect to the xds server on startup, there's
a race between the xds client placing the error on the channel
and the resource manager dropping the receiver due to no longer
being able to receive updates from the client.
If the latter happens first, we get a generic 'channel dropped' error
message instead of the actual error message.

This adds a short sleep before checking the channel for an error message
to give the client enough time to send the error.

Also return a result from main rather than unwrapping. Doesn't change
much beyond the error message being less scarier if it doesn't show
up as a panic.
@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: 72238e45-da21-4a38-9f58-09f7f8942916

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/273/head:pr_273 && git checkout pr_273
cargo build

@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: d54b896d-2657-408e-8eb6-def90b401b97

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/273/head:pr_273 && git checkout pr_273
cargo build

@@ -201,6 +201,9 @@ impl DynamicResourceManagers {
// initialize properly.
// Check the client's execution result if exiting was due to some root cause
// error and return that error if so. Otherwise return a generic error.
// Wait a bit before checking the channel to give the client enough time
// to put any values on the channel.
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
Copy link
Member

Choose a reason for hiding this comment

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

Rather than a sleep in the code, which always freaks me out a little 😄 as they tend to hide things, and can be annoyingly inconsistent, we do a blocking operation, with a timeout instead?

Something like tokio::time::timeout(Duration::from_secs(5), execution_result_rx) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A blocking wouldn't help in this case unfortunately, the issue is that if we check too soon we get an error back that the channel is closed (so blocking here will return immediately with an error)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wait yeah this should work just fine its the same thing, not sure what I was thinking will fix!

@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: 0290fc54-75d4-4a37-8864-6941b5539dca

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/273/head:pr_273 && git checkout pr_273
cargo build

@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: d55fa14a-2932-4de9-811d-515595a475ed

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/273/head:pr_273 && git checkout pr_273
cargo build

@iffyio iffyio requested a review from markmandel May 22, 2021 08:41
Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

LGTM

@markmandel markmandel merged commit 9692af9 into main May 23, 2021
@markmandel markmandel deleted the iu/xds-execution-result branch May 23, 2021 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants