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
Tracing: the default BackendSpanExporter's HTTP client is never closed #4681
BatchTraceProcessor.shutdown() sets its shutdown event, optionally calls the exporter's
private _request_shutdown(), and joins the worker thread — it never calls self._exporter.close(). Grepping the repo, the only callers of exporter.close() are in tests/test_trace_processor.py.
The TLS connection(s) to api.openai.com are left open until the interpreter tears the
socket down, producing ResourceWarning: unclosed <ssl.SSLSocket ...> under -W error::ResourceWarning or PYTHONDEVMODE=1 (this breaks strict CI setups that treat
ResourceWarnings as errors).
Applications that replace the global trace provider / processor at runtime (multi-tenant
servers switching export API keys, test suites that build a fresh BatchTraceProcessor(BackendSpanExporter(...)) per case) leak one client and its
connection pool per replacement.
Suggested fix
Have BatchTraceProcessor.shutdown() call close() on its exporter when the exporter
exposes one, mirroring the existing _request_shutdown duck-typing:
Changed: Close the lazily-created default tracing exporter at the setup/provider shutdown boundary after the final flush, while leaving injected exporters under caller ownership.
Tests: The tracing-focused suites pass (159 tests), with Ruff format/check, mypy, and git diff --check also passing.
Activity
mikemikimike commentedon Aug 27, 2026
Implemented in PR #4710.
seratch commentedon Aug 31, 2026
Closing this issue for the reason I stated at #4737 (comment)