Skip to content

RuntimeError: can't create new thread at interpreter shutdown #4752

Open

Description

@emdneto

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: python/cpython#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.

Activity

  1. emdneto commented on Sep 16, 2025

    @emdneto
    MemberAuthor

    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

  2. aabmass commented on Oct 9, 2025

    @aabmass
    Member

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

  3. emdneto commented on Dec 24, 2025

    @emdneto
    MemberAuthor

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

    Hey @aabmass, sorry, I missed this.

    It seems so, but we still see the RuntimeError on our end. AFAICS, people are catching the error and suppressing it as a workaround.

  4. added 2 commits that reference this issue on Aug 28, 2026
    a429609
    ed419e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions