Skip to content

Handle status code infinite loop#162

Merged
TomerShor merged 6 commits intov3io:developmentfrom
weilerN:NUC-587-handle-status-code-infinite-loop
Dec 23, 2025
Merged

Handle status code infinite loop#162
TomerShor merged 6 commits intov3io:developmentfrom
weilerN:NUC-587-handle-status-code-infinite-loop

Conversation

@weilerN
Copy link
Contributor

@weilerN weilerN commented Dec 18, 2025

📝 Description

This change improves non-fatal engine error detection by complementing the existing string-based logic with HTTP status-code awareness.

Errors that expose an HTTP status code (e.g. V3IO errors) are now handled explicitly, allowing transient failures such as HTTP 503 (Service Unavailable) to be classified correctly and retried. The logic safely unwraps nested errors and preserves existing behavior.


🛠️ Changes Made

  • Refactored EngineErrorIsNonFatal to support multiple error-matching strategies.
  • Added HTTP status-code based detection for non-fatal errors (e.g. 503 Service Unavailable).
  • Preserved existing string-based matching for backward compatibility.
  • Minor formatting fixes to satisfy linting and alignment rules.

🧪 Testing

  • Comprehensive unit tests were added to validate both string-based and status-code-based detection,
  • Specific Unit test with deeply wrapped the error scenario observed in the bug description.
  • Regression test:
    • Verified that existing trigger flows remain unchanged

🔗 References

Copy link
Collaborator

@TomerShor TomerShor left a comment

Choose a reason for hiding this comment

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

Looks good!
Added some suggestions

Comment on lines 190 to 192
checkFunctions := []func(error) bool{
matchErrorString,
matchErrorStatusCode,
Copy link
Collaborator

Choose a reason for hiding this comment

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

make the intent of each function more explicit and improve code readability:

Suggested change
checkFunctions := []func(error) bool{
matchErrorString,
matchErrorStatusCode,
nonFatalErrorChecks := []func(error) bool{
isNonFatalErrorString,
isNonFatalStatusCode,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@weilerN weilerN marked this pull request as ready for review December 21, 2025 15:29
@weilerN weilerN requested a review from TomerShor December 21, 2025 15:29
Copy link
Contributor

@rokatyy rokatyy left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise approved ✅

}

// isNonFatalErrorString checks whether the error message contains any of the predefined non-fatal substrings
func isNonFatalErrorString(e error) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func isNonFatalErrorString(e error) bool {
func isNonFatalErrorString(err error) bool {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here - CR 2 - namings

}

// isNonFatalStatusCode checks whether the error contains any of the predefined non-fatal HTTP status codes
func isNonFatalStatusCode(e error) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func isNonFatalStatusCode(e error) bool {
func isNonFatalStatusCode(err error) bool {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here - CR 2 - namings

"dialing to the given TCP address timed out",
"timeout",
"refused",
nonFatalErrorChecks := []func(error) bool{
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
nonFatalErrorChecks := []func(error) bool{
nonFatalErrorCheckFunctions := []func(error) bool{

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here - CR 2 - namings

Copy link
Collaborator

@TomerShor TomerShor left a comment

Choose a reason for hiding this comment

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

LGTM

@TomerShor TomerShor merged commit 6069d82 into v3io:development Dec 23, 2025
2 checks passed
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