-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: update error handling logic for reconnection attempts #1978
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
Conversation
PR Review: Fix error code (0) and HTTP status codes (400-599) reconnection handlingSummaryThis PR modifies the ✅ Positive Aspects
|
21bf335 to
8d2c961
Compare
8d2c961 to
a3bac72
Compare
Code Review: PR #1978 - Update Error Handling Logic for ReconnectionSummaryThis PR changes the error handling strategy from an opt-in (whitelist) approach to an opt-out (blacklist) approach. While this may handle transient errors more gracefully, it introduces several significant risks that need to be addressed. 🔴 Critical Issues1. Overly Aggressive Reconnection LogicThe new logic assumes all errors are retryable by default unless explicitly blacklisted. This is a risky assumption that could lead to:
Recommendation: Consider a hybrid approach:
2. Incomplete Error Code BlacklistOnly NON_RECONNECTABLE_ERROR_CODES = [
VOLCENGINE_ERROR_CODES["INVALID_PARAMETER"], # 400xxxxx
VOLCENGINE_ERROR_CODES["AUTHENTICATION_FAILED"], # 401xxxxx - Auth won't fix itself
VOLCENGINE_ERROR_CODES["PERMISSION_DENIED"], # 403xxxxx - Permission issues
VOLCENGINE_ERROR_CODES["NOT_FOUND"], # 404xxxxx - Resource doesn't exist
VOLCENGINE_ERROR_CODES["UNSUPPORTED_OPERATION"], # 405xxxxx - Invalid operation
VOLCENGINE_ERROR_CODES["REQUEST_TIMEOUT"], # Could debate this one
VOLCENGINE_ERROR_CODES["CONFLICT"], # 409xxxxx - State conflict
VOLCENGINE_ERROR_CODES["QUOTA_EXCEEDED"], # 429xxxxx - Rate limit reached
# Add more based on API documentation
]3. Loss of Range-Based Error HandlingThe old code had logic for handling error ranges (e.g., Question: Does the Volcengine API document error code ranges? If so, we should preserve this capability.
|
a3bac72 to
cce34bd
Compare
Code Review: PR #1978 - Update Error Handling Logic for ReconnectionSummaryThis PR fundamentally changes the error reconnection strategy from an opt-in (whitelist) approach to an opt-out (blacklist) approach. The new logic assumes all errors are retryable by default unless explicitly marked as non-retryable. While this approach has merit for handling unknown transient errors, there are several concerns that should be addressed. 📊 Changes OverviewFiles Modified:
Core Logic Change: # OLD (whitelist): Only retry known reconnectable errors
if error_code in RECONNECTABLE_ERROR_CODES:
return True
if 55000000 <= error_code <= 55099999: # Internal errors range
return True
return False
# NEW (blacklist): Retry everything except known non-retryable errors
if error_code in NON_RECONNECTABLE_ERROR_CODES:
return False
return True # Default: retry✅ Positive Aspects
|
No description provided.