You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pyo3: external header provider can hang during interpreter finalization #536
The pyo3 binding's external header provider (Session(auth_type="external", header_provider=...), added in #527) runs the Python callable on a Tokio blocking-pool thread and attaches to the interpreter for each call (pyo3/src/auth.rs).
If an authenticated request runs while the Python interpreter is shutting down, for example a best-effort close spawned from Drop or a telemetry flush, that thread calls Python::attach during finalization. Depending on the Python version, the thread then hangs or is terminated, so interpreter exit can stall.
Suggested fix: before attaching, check whether the interpreter is finalizing (Py_IsFinalizing, or pyo3's equivalent). If it is, fail the request with Unauthenticated ("interpreter is shutting down") instead of calling the provider. Add a regression test that drops a session with an external provider during shutdown.
This only affects interpreter shutdown; normal requests are unaffected. Raised by the review bot on #527.
Activity