googleapis / googleapis/google-cloud-python
google-auth: connection leaks in urllib3 transport and metadata helper during mTLS updates
- 主要言語
- Python
- スター
- 5.4k
- フォーク
- 1.8k
- 平均マージ
- 3日 4時間
- マージ済み PR(30日)
- 122
説明
When mTLS is configured or dynamically updated, the SDK creates and mounts new HTTP adapters/transports but leaves the old ones hanging. While PR #17689 addressed this for the `requests` transport, the leak still exists in two other places:
1. **urllib3 transport (`google/auth/transport/urllib3.py`)**
In `configure_mtls_channel`, `self.http = new_http` replaces the old PoolManager. We need to call `.clear()` on the old `PoolManager` instance before overwriting it so that the active connection pool is cleaned up.
2. **Compute Engine metadata (`google/auth/compute_engine/_metadata.py`)**
If mTLS is enabled, `_metadata.py` instantiates and mounts a new `MdsMtlsAdapter` on the session for every single request. Overwriting the mounted adapter without closing the old one leaks sockets. We should either cache and reuse the adapter or close the old one before mounting.
コントリビューションガイド
調査の方向性
Read google/auth/transport/urllib3.py and google/auth/compute_engine/_metadata.py, starting with configure_mtls_channel and the per-request MdsMtlsAdapter mounting path. Confirm the old PoolManager is cleaned up and the metadata adapter is reused or closed rather than accumulating sockets, then add or run focused regression tests for both paths.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- gcp, python
- 領域
- backend, cloud
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 72/100