Skip to content

JIT: assertion failure in _Py_DECREF_NO_DEALLOC #143026

Closed

Description

@devdanzin

Crash report

What happened?

It's possible to make a debug JIT build abort by running the code below:

import gc
gc.set_threshold(1)

def f1():
    for i in range(5000):
        globals()[''] = i

f1()

Error message and backtrace:

Fatal Python error: _Py_DECREF_NO_DEALLOC: Expected a positive remaining refcount: bug likely caused by a refcount error in a C extension
Python runtime state: initialized

Current thread 0x00007ffff7e503c0 [python] (most recent call first):
  File "/home/danzin/crashers/reduced_crash_signal_SIGABRT_child_934_78_2.py", line 6 in f1
  File "/home/danzin/crashers/reduced_crash_signal_SIGABRT_child_934_78_2.py", line 8 in <module>

Program received signal SIGABRT, Aborted.

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:100
#3  0x00007ffff7c45e2e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7c28888 in __GI_abort () at ./stdlib/abort.c:77
#5  0x000055555609fbb4 in fatal_error_exit (status=status@entry=-1) at Python/pylifecycle.c:3284
#6  0x000055555609f7f6 in fatal_error (fd=<optimized out>, header=<optimized out>, prefix=<optimized out>, msg=<optimized out>, status=<optimized out>) at Python/pylifecycle.c:3493
#7  0x000055555609fb8e in _Py_FatalErrorFormat (func=<optimized out>, format=<optimized out>) at Python/pylifecycle.c:3546
#8  0x000055555609fbf6 in _Py_FatalRefcountErrorFunc (func=0x555556505200 <__func__._Py_DECREF_NO_DEALLOC> "_Py_DECREF_NO_DEALLOC",
    msg=0x555556505240 <str> "Expected a positive remaining refcount") at Python/pylifecycle.c:3553
#9  0x0000555556065d95 in _Py_DECREF_NO_DEALLOC (op=0x7d9ff6ff98a0) at ./Include/internal/pycore_object.h:269
#10 _Py_ClearExecutorDeletionList (interp=0x5555569764a0 <_PyRuntime+133952>) at Python/optimizer.c:313
#11 0x0000555555fedf1e in _Py_HandlePending (tstate=tstate@entry=0x5555569ad330 <_PyRuntime+358864>) at Python/ceval_gil.c:1401
#12 0x0000555555eedfa7 in check_periodics (tstate=<optimized out>) at Python/ceval_macros.h:494
#13 _PyTier2Interpreter (current_executor=<optimized out>, frame=<optimized out>, stack_pointer=<optimized out>, tstate=<optimized out>) at Python/executor_cases.c.h:59
#14 0x0000555555e7422e in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at Python/generated_cases.c.h:5348
#15 0x0000555555e4ef98 in _PyEval_EvalFrame (tstate=0x5555569ad330 <_PyRuntime+358864>, frame=0x7e8ff6fe5220, throwflag=0) at ./Include/internal/pycore_ceval.h:119
#16 _PyEval_Vector (tstate=<optimized out>, func=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=0x0) at Python/ceval.c:2483

Output from running with PYTHON_LLTRACE=4 PYTHON_OPT_DEBUG=4:
934_abort_lltrace_opt_debug.txt

Found using lafleur.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

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

Python 3.15.0a3+ (heads/main:5989095dfd0, Dec 20 2025, 16:09:33) [Clang 21.1.2 (2ubuntu6)]

Linked PRs

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on Dec 20, 2025
  2. added a commit that references this issue on Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-JITtype-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