-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(nodes): per-thread Google transport and GET-only retries for transport faults #2037
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
Open
rishinaren
wants to merge
1
commit into
rocketride-org:develop
Choose a base branch
from
rishinaren:fix/RR-2034-per-thread-google-transport
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: rocketride-org/rocketride-server
Length of output: 50389
🌐 Web query:
google-auth-httplib2 AuthorizedHttp request exception TransportError httplib2 HttpLib2Error source💡 Result:
The library google-auth-httplib2 is deprecated and no longer maintained [1][2][3]. Google strongly discourages its use due to known issues with httplib2, including a lack of thread safety and insecure TLS implementation [1][2]. If you encounter an exception involving AuthorizedHttp and TransportError (or HttpLib2Error) while using this library, consider the following points: 1. Recommended Migration: The official recommendation is to migrate away from google-auth-httplib2 to the transport layers provided directly by the main google-auth library, such as those using urllib3 or requests [1][2]. 2. Understanding the Errors: - TransportError is a generic exception in the google-auth library used to indicate that an error occurred during an HTTP request [4]. It is often raised when the underlying transport layer (like httplib2 or urllib3) encounters connectivity or protocol issues [5][6]. - HttpLib2Error is the base exception class for all errors raised by the httplib2 library itself [7]. 3. Common Troubleshooting: - Known Compatibility/Timeout Issues: Recent versions of related Google libraries have raised warnings or errors regarding httplib2's inability to support per-request timeouts [8][9]. If you must continue using httplib2, you should explicitly set the timeout when constructing the httplib2.Http instance [8][9]. - Versioning: Ensure you are using the latest version of httplib2, as some common errors (such as TypeError related to bytes/strings) are resolved by upgrading [10]. - Debugging: Because google-auth-httplib2 is unmaintained, deep technical support for specific low-level transport errors is limited. Migrating to a modern transport (urllib3/requests) is the most effective way to resolve persistent transport-related exceptions [1][2].
Citations:
🌐 Web query:
httplib2 exception classes HttpLib2Error socket timeout documentation💡 Result:
In httplib2, HttpLib2Error serves as the base class for all exceptions specifically defined and raised by the library [1][2][3]. Regarding socket timeouts, httplib2 does not define a specific exception class for them. Instead, it propagates underlying socket-level exceptions, such as socket.timeout, directly to the caller [4]. Key points regarding error handling in httplib2: 1. Exception Classes: httplib2 defines several exception classes, all inheriting from HttpLib2Error, such as RedirectLimit, ServerNotFoundError, and RelativeURIError [1][5][6]. These are documented in the official library documentation [1][7]. 2. Socket Timeouts: When a socket timeout occurs during a request, the library raises the standard socket.timeout exception [4]. 3. Controlling Exception Behavior: By default, httplib2 raises exceptions when errors occur [1][3]. However, you can control this behavior using the Http.force_exception_to_status_code attribute [1][2][3]. - If set to True, the library attempts to turn error conditions (including those that would otherwise raise exceptions) into HTTP Response objects with appropriate status codes, rather than raising the exception [1][3]. - If set to False (the default), exceptions are raised normally [1][3]. Note that while force_exception_to_status_code is intended to suppress exceptions, historical issues have been reported where specific timeout scenarios could lead to connection management problems, such as dead connections being reused in subsequent requests [8][9]. Top results: [1][8][6][4]
Citations:
🌐 Web query:
googleapiclient.http.HttpRequest execute exception behavior HttpError transport exceptions source💡 Result:
The execute method of googleapiclient.http.HttpRequest behaves differently depending on whether the issue is related to the HTTP response or the underlying transport layer [1][2]. 1. HTTP Errors: If the API request completes but returns an HTTP status code outside the 2xx range (e.g., 4xx or 5xx errors), execute raises a googleapiclient.errors.HttpError [1][2]. This exception contains the response object, the content, and the URI, allowing you to access the status code and error details [3][4]. It is standard practice to wrap the execute call in a try-except block to catch HttpError [5][4]. 2. Transport Exceptions: If a transport-level error occurs (e.g., connection issues, timeouts, or DNS failures), the method raises exceptions from the underlying transport library, commonly httplib2.HttpLib2Error [1][2]. Because these are distinct from HttpError, they must be caught separately if you wish to handle network-level failures distinct from API-level errors [1]. In summary, when performing requests, you should implement error handling as follows [5][4]: try: response = request.execute except googleapiclient.errors.HttpError as e: # Handle API-level errors (e.g., 404 Not Found, 403 Forbidden) print(f'API Error {e.status_code}: {e.reason}') except httplib2.HttpLib2Error as e: # Handle transport-level errors (e.g., connection lost, timeout) print(f'Transport Error: {e}') Note that if you enable retries via the num_retries argument in execute, the library will attempt to handle certain transient errors automatically before potentially raising the final HttpError or transport exception [2][6].
Citations:
🏁 Script executed:
Repository: rocketride-org/rocketride-server
Length of output: 5045
🏁 Script executed:
Repository: rocketride-org/rocketride-server
Length of output: 442
🌐 Web query:
site:github.com/googleapis/google-auth-library-python-httplib2 AuthorizedHttp TransportError httplib2.py request💡 Result:
The TransportError in the context of AuthorizedHttp (provided by the google-auth-library-python-httplib2 package) is a general exception raised by the underlying httplib2 library when it encounters issues during the execution of a network request [1][2]. Because google-auth-library-python-httplib2 acts as a transport layer wrapper around httplib2, it surfaces exceptions generated by the underlying httplib2.Http.request method [1]. Common causes for TransportError include: 1. Network connectivity issues or timeouts. 2. SSL/TLS handshake failures or certificate validation errors. 3. Issues with the underlying connection pool maintained by httplib2. Key considerations for this error: - Maintenance Status: The google-auth-library-python-httplib2 library is no longer actively maintained [1][2]. It was originally designed to assist users in migrating from older oauth2client-based implementations to google-auth [1][2]. - Official Recommendation: Google strongly discourages the use of httplib2 due to known issues regarding thread safety and insecure TLS usage [1][2]. Developers are encouraged to use the standard transport layers provided by the primary google-auth library instead [1][2]. - Debugging: Since the error originates from httplib2, you can often inspect the specific cause by catching the TransportError and checking its message or underlying cause (e.g., socket.error or ssl.SSLError). If you are encountering this error, the most robust long-term solution is to migrate your code away from google-auth-httplib2 to modern, supported transport mechanisms (such as those based on requests or httpx) recommended in the current Google Cloud Python client documentation [1][2].
Citations:
🌐 Web query:
site:github.com/googleapis/google-api-python-client googleapiclient/http.py httplib2.HttpLib2Error execute💡 Result:
In the google-api-python-client library, the execute method is defined within the HttpRequest class in the googleapiclient/http.py module [1][2]. The execute method is responsible for performing the HTTP request and handles the transmission of the request to the Google API [1][3]. When an error occurs during the transport phase of the request, the library may raise an httplib2.HttpLib2Error [1][4]. Specifically, the library's official documentation and source code indicate that httplib2.HttpLib2Error is raised when a transport-level error has occurred [1][3]. Key details regarding this error and method include: 1. Relationship to Execute: The execute method wraps the request process [1]. If the transport mechanism (httplib2) encounters an issue, such as a connection problem or a protocol error, it bubbles up to the caller as an HttpLib2Error [1][5]. 2. Retriable Exceptions: In many implementations using this library, httplib2.HttpLib2Error is often categorized as a retriable exception [6]. Developers frequently maintain a list of exceptions—including httplib2.HttpLib2Error and various connection-related errors like IncompleteRead or BadStatusLine—to implement retry logic with exponential backoff [6][7]. 3. Distinction from HttpError: It is important to distinguish between HttpLib2Error and googleapiclient.errors.HttpError [1][8]. The former (HttpLib2Error) typically represents transport or network-level issues [1][3], while the latter (HttpError) is raised by the library when the server returns an unsuccessful HTTP status code (e.g., 4xx or 5xx) [1][8]. If you are encountering this error, it often suggests an underlying network instability, such as a connection timeout, a reset connection (ECONNRESET), or an issue where a redirect is missing a required location header [9][5][7]. Investigating the network environment or ensuring that retry logic is correctly implemented is the standard approach to handling these exceptions [6].
Citations:
🏁 Script executed:
Repository: rocketride-org/rocketride-server
Length of output: 787
🏁 Script executed:
Repository: rocketride-org/rocketride-server
Length of output: 203
🏁 Script executed:
Repository: rocketride-org/rocketride-server
Length of output: 162
Restrict status-less retries to transport exceptions.
execute()retries every status-lessGETexception, includingValueError. This can make four calls and add seven seconds of delay before failure. Limit this branch to the transport exception classes used byhttplib2and Google authentication. Add a test that raises a status-lessValueErrorand asserts one call.🤖 Prompt for AI Agents