opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

RuntimeError: can't create new thread at interpreter shutdown

Open emdneto opened this issue 3 months ago • 2 comments

Describe your environment

OS: Ubuntu Python version: 3.12.0, 3.12.1, 3.12.2 SDK version: Since 1.36.0 API version: Since 1.36.0

What happened?

Exception ignored in atexit callback: <function shutdown at 0x72be9c2a93a0>
Traceback (most recent call last):
  File "/home/codespace/.python/current/lib/python3.12/logging/__init__.py", line 2271, in shutdown
    h.flush()
  File "/workspaces/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py", line 654, in flush
    thread.start()
  File "/home/codespace/.python/current/lib/python3.12/threading.py", line 992, in start
    _start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown

Steps to Reproduce

  1. Run the example here with python 3.12.0

Expected Result

No RuntimeError

Actual Result

RuntimeError

Additional context

Got this after this PR

Probably due to: https://github.com/python/cpython/issues/113964

Would you like to implement a fix?

None

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

emdneto avatar Sep 15 '25 22:09 emdneto

From python >=3.12.3 there's no issue. it seems the issue happens with python 3.12.0, 3.12.1 and 3.12.2

emdneto avatar Sep 16 '25 00:09 emdneto

Is this WAI @emdneto ? Last time I looked at this the CPython bugs insisted this is the expected behavior

aabmass avatar Oct 09 '25 17:10 aabmass