Visitar URL original
Fatal Python error from `warnings._release_lock()` · Issue #129766 · python/cpython · GitHub
Skip to content

Fatal Python error from warnings._release_lock() #129766

Description

@devdanzin

Crash report

What happened?

Exposing the mutex used by the _warnings module in #128386 has made it possible to abort the interpreter by calling warnings._release_lock():

import warnings
warnings._release_lock()

Error message:

Fatal Python error: _PyRecursiveMutex_Unlock: unlocking a recursive mutex that is not owned by the current thread
Python runtime state: initialized

Current thread 0x0000718eb9295740 (most recent call first):
  File "<string>", line 1 in <module>
Aborted (core dumped)

Found using fusil by @vstinner.

CPython versions tested on:

CPython main branch, 3.14

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a4+ (heads/main:e1006ce1de, Feb 6 2025, 17:22:01) [GCC 13.3.0]

Linked PRs

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Feb 7, 2025
  2. devdanzin commented on Feb 7, 2025

    @devdanzin
    MemberAuthor
  3. self-assigned this
    on Feb 7, 2025
  4. sobolevn commented on Feb 7, 2025

    @sobolevn
    Member

    We should use _PyRecursiveMutex_TryUnlock and raise RuntimeError instead, like in many other places.

  5. added 3 commits that reference this issue on Feb 7, 2025
  6. sobolevn commented on Feb 7, 2025

    @sobolevn
    Member

    Fixed! Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions