googleapis / googleapis/google-cloud-python

google-auth: connection leaks in urllib3 transport and metadata helper during mTLS updates

Ouverte
#17,755 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
5.4k
Forks
1.8k
Merge moyen
3 j 4 h
PR mergées (30 j)
122

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
gcp, python
Domaine
backend, cloud
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
72/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.