| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request updates the Connection.close() method to explicitly close the underlying gRPC channel of the BigQuery Storage client's transport, preventing potential socket leaks. It also refactors unit tests to mock the public transport property instead of the private _transport attribute. The review feedback suggests using mock.patch.object with self.addCleanup to prevent test pollution when mocking the transport property, and using getattr instead of hasattr to safely check for _grpc_channel and avoid potential AttributeErrors if the channel is None.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
🤖 I have created a release *beep* *boop* --- ## [3.42.3](google-cloud-bigquery-v3.42.2...google-cloud-bigquery-v3.42.3) (2026-07-30) ### Bug Fixes * **bigquery:** dbapi socket leak ([#17921](#17921)) ([d328e3b](d328e3b)) * bump grpcio to 1.59.0; require Python 3.10+ ([#17351](#17351)) ([a53487a](a53487a)) * require Protobuf 6.33.5+ ([#17743](#17743)) ([d267342](d267342)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Problem
The system test test_dbapi_connection_does_not_leak_sockets fails intermittently because network connections remain in the ESTABLISHED state even after connection.close() is called. This is likely due to the underlying gRPC (remote procedure call) transport not being immediately closed, or delays in Garbage Collection (cleaning up unused memory).
Solution
This Pull Request updates Connection.close() to explicitly close the underlying gRPC channel (transport._grpc_channel) if it exists on the BigQuery Storage client. This ensures that the connection is closed immediately and resources are released deterministically.
Notes to Reviewers
Sample debug info from traceback: