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

[release/0.8] Add reconnect logic for stdio pipes #1214

Merged
merged 2 commits into from
Nov 2, 2021

Conversation

dcantah
Copy link
Contributor

@dcantah dcantah commented Nov 2, 2021

This change adds retry logic on the stdio relay if the server end of the named pipe
disconnects. This is a common case if containerd restarts for example.
The current approach is to make a io.Writer wrapper that handles the
reconnection logic on a write failure if it can be determined that the error
is from a disconnect. A new shim config option is exposed to tailor the retry timeout.

This changes also adds cenkalti/backoff/v4 as a dependency to be used for handling
exponential backoff logic for the stdio connection retry attempts. Retrying
at a fixed interval is a bit naive as all of the shims would potentially
be trying to reconnect to 3 pipes continuously all in bursts.
This allows us to space out the connections, set an upper limit on timeout
intervals and add an element of randomness to the retry attempts.

Signed-off-by: Daniel Canter dcanter@microsoft.com
(cherry picked from commit 573c137)
Signed-off-by: Daniel Canter dcanter@microsoft.com

This change adds retry logic on the stdio relay if the server end of the named pipe
disconnects. This is a common case if containerd restarts for example.
The current approach is to make a io.Writer wrapper that handles the
reconnection logic on a write failure if it can be determined that the error
is from a disconnect. A new shim config option is exposed to tailor the retry timeout.

This changes also adds cenkalti/backoff/v4 as a dependency to be used for handling
exponential backoff logic for the stdio connection retry attempts. Retrying
at a fixed interval is a bit naive as all of the shims would potentially
be trying to reconnect to 3 pipes continuously all in <timeout> bursts.
This allows us to space out the connections, set an upper limit on timeout
intervals and add an element of randomness to the retry attempts.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
(cherry picked from commit 573c137)
Signed-off-by: Daniel Canter <dcanter@microsoft.com>
This change just runs go mod vendor in test to bring release/0.8 up to speed.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
@dcantah dcantah requested a review from a team as a code owner November 2, 2021 01:40
@dcantah
Copy link
Contributor Author

dcantah commented Nov 2, 2021

@microsoft/containerplat Can anyone give this some eyes?

@dcantah dcantah merged commit b3b9c7a into microsoft:release/0.8 Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants