Avoid panics on not owner errors because they should go away#169
Merged
Avoid panics on not owner errors because they should go away#169
Conversation
sgarciapdx
approved these changes
Jun 29, 2021
mattayes
reviewed
Jun 29, 2021
Comment on lines
+168
to
170
| if err != nil && err != registry.ErrNotOwner { | ||
| panic(fmt.Errorf("%w: unable to deregister mailbox: %v, error: %v", errDeregisteredFailed, nsName, err)) | ||
| } |
Contributor
There was a problem hiding this comment.
[Q] How do we know these will go away?
Contributor
Author
There was a problem hiding this comment.
They are owned by an expired lease
epsniff
reviewed
Jun 29, 2021
epsniff
reviewed
Jun 29, 2021
epsniff
approved these changes
Jun 29, 2021
Co-authored-by: Eric Sniff <epsniff@users.noreply.github.com>
mattayes
approved these changes
Jun 29, 2021
Comment on lines
166
to
+171
| return err != nil | ||
| }) | ||
| if err != nil { | ||
| // Ingnore ErrNotOwner because most likely the previous owner panic'ed or exited badly. | ||
| // So we'll ignore the error and let the mailbox creator retry later. We don't want to panic | ||
| // in that case because it will take down more mailboxes and make it worse. | ||
| if err != nil && err != registry.ErrNotOwner { |
Contributor
There was a problem hiding this comment.
We should check this earlier, otherwise we're doing unnecessary retries:
switch {
case err == nil:
return false
// Ignore ErrNotOwner because most likely the previous owner panic'ed or exited badly.
// So we'll ignore the error and let the mailbox creator retry later. We don't want to panic
// in that case because it will take down more mailboxes and make it worse.
case errors.Is(err, registry.ErrNotOwner):
err = nil
return false
default:
return true
}
})
if err != nil {
panic(fmt.Errorf("%w: unable to deregister mailbox: %v, error: %v", errDeregisteredFailed, nsName, err))
}
Comment on lines
471
to
478
| return err != nil | ||
| }) | ||
| if err != nil { | ||
| // Ingnore ErrNotOwner because most likely the previous owner panic'ed or exited badly. | ||
| // So we'll ignore the error and let the mailbox creator retry later. We don't want to panic | ||
| // in that case because it will take down more mailboxes and make it worse. | ||
| if err != nil && err != registry.ErrNotOwner { | ||
| panic(fmt.Sprintf("unable to deregister actor: %v, error: %v", nsName, err)) | ||
| } |
Contributor
There was a problem hiding this comment.
Same here:
switch {
case err == nil:
return false
case errors.Is(err, registry.ErrNotOwner):
err = nil
return false
default:
return true
}
})
if err != nil {
panic(fmt.Errorf("%w: unable to deregister mailbox: %v, error: %v", errDeregisteredFailed, nsName, err))
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.