googleapis / googleapis/google-cloud-python

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

Aperta
#17,755 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
5.4k
Fork
1.8k
Merge medio
3g 4h
PR unite (30g)
122

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
gcp, python
Ambito
backend, cloud
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
72/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.