-
Notifications
You must be signed in to change notification settings - Fork 22
Wait forever for fatal errors #155
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,13 +41,19 @@ func RetryFunc(ctx context.Context, | |
| attempts int, | ||
| retryInterval *time.Duration, | ||
| backoff *Backoff, | ||
| fn func(int) (bool, error)) error { | ||
| fn func(int) (bool, error, int)) error { | ||
|
|
||
| var err error | ||
| var retry bool | ||
| var addAttempts int | ||
|
|
||
| for attempt := 1; attempt <= attempts; attempt++ { | ||
| retry, err = fn(attempt) | ||
| var attempt = 0 | ||
| for attempt <= attempts { | ||
|
|
||
| attempt++ | ||
| // some errors might require more attempts than expected, so allow incrementing attempts from outside | ||
| retry, err, addAttempts = fn(attempt) | ||
| attempts += addAttempts | ||
|
|
||
| // if there's no need to retry - we're done | ||
| if !retry { | ||
|
|
@@ -178,9 +184,19 @@ func EngineErrorIsNonFatal(err error) bool { | |
| "timeout", | ||
| "refused", | ||
| } | ||
| return errorMatches(err, nonFatalEngineErrorsPartialMatch) | ||
| } | ||
|
|
||
| func EngineErrorIsFatal(err error) bool { | ||
| var fatalEngineErrorsPartialMatch = []string{ | ||
| "Failed to fetch record batches", | ||
|
||
| } | ||
| return errorMatches(err, fatalEngineErrorsPartialMatch) | ||
| } | ||
| func errorMatches(err error, substrings []string) bool { | ||
|
Comment on lines
195
to
202
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline |
||
| if err != nil && len(err.Error()) > 0 { | ||
| for _, nonFatalError := range nonFatalEngineErrorsPartialMatch { | ||
| if strings.Contains(err.Error(), nonFatalError) || strings.Contains(errors.Cause(err).Error(), nonFatalError) { | ||
| for _, substring := range substrings { | ||
| if strings.Contains(err.Error(), substring) || strings.Contains(errors.Cause(err).Error(), substring) { | ||
| return true | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -126,31 +126,46 @@ func (c *claim) fetchRecordBatches(stopChannel chan struct{}, fetchInterval time | |||||||||||||||||||||||
| c.logger, | ||||||||||||||||||||||||
| c.getShardLocationAttempts, | ||||||||||||||||||||||||
| nil, | ||||||||||||||||||||||||
| &c.getShardLocationBackoff, func(attempt int) (bool, error) { | ||||||||||||||||||||||||
| &c.getShardLocationBackoff, func(attempt int) (bool, error, int) { | ||||||||||||||||||||||||
| c.currentShardLocation, err = c.getCurrentShardLocation(c.shardID) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| &c.getShardLocationBackoff, func(attempt int) (bool, error, int) { | |
| c.currentShardLocation, err = c.getCurrentShardLocation(c.shardID) | |
| &c.getShardLocationBackoff, | |
| func(attempt int) (bool, error, int) { | |
| c.currentShardLocation, err = c.getCurrentShardLocation(c.shardID) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually doesn't log the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 71 to 81 in 0d34f11
| loggerInstance.WarnWithCtx(ctx, | |
| "Context error detected during retries", | |
| "ctxErr", ctx.Err(), | |
| "previousErr", err, | |
| "function", getFunctionName(fn), | |
| "attempt", attempt) | |
| // return the error if one was provided | |
| if err != nil { | |
| return err | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning is for a ctx.Error, like if an external error happened.
In your case you check the error returned from getCurrentShardLocation, which isn't handled by the retry func.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomerShor right 🤦
i'll remove comment
Uh oh!
There was an error while loading. Please reload this page.