E542 [bump_v19.03] Fix panic in agent by dperny · Pull Request #3031 · moby/swarmkit · GitHub
[go: up one dir, main page]

Skip to content

Conversation

dperny
Copy link
Collaborator
@dperny dperny commented Oct 13, 2021

Backport of #3024 to the 19.03 branch.

Previously, there was an issue where the agent could panic while
attempting to determine if an error was temporary.

Before the change, in `agent/exec/errors.go`, the function `IsTemporary`
attempted to drill down to a root cause by iterating through the causes
of an error by calling `errors.Cause`. If an error has no cause, then
`errors.Cause` returns that same error.

The issue is that somewhere in the depths of some code, it was posssible
for the error to have an underlying type that was non-comparable; for
example, maps and slices are uncomparable types. This would cause a
panic, as the uncomparable type cannot be compared even to itself.

However, one can see that `errors.Cause` has its own loop, and drills
down to the root cause in its own way. There is no need for us to
iterate here.

Instead, we can just take a look at the error itself, and then take a
look at its cause once. If neither is temporary, the error is not
temporary, and we have nothing to worry about.

Signed-off-by: Drew Erny <derny@mirantis.com>
(cherry picked from commit 39a4233)
Signed-off-by: Drew Erny <derny@mirantis.com>
@dperny dperny merged commit 732bcc8 into moby:bump_v19.03 Oct 14, 2021
@thaJeztah
Copy link
Member

This needed for 20.10 as well, or already done? (https://github.com/docker/swarmkit/tree/bump_20.10)

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.

2 participants
0