Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Assertion failure in optimize_uops in a JIT build #137762

Closed
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs) topic-JIT type-crashA hard crash of the interpreter, possibly with a core dump
@devdanzin

Description

Crash report

What happened?

It's possible to make a JIT build abort by running the code generated by the script below. The numbers were selected to make it reproduce without triggering #137728. Please let me know if you can reproduce.

from pathlib import Path
header = """
def f1():
 def f1_1(): pass
 def f1_2(): pass
 funcs = f1_1, f1_2
 for i in range(200):
 try: funcs[i % 2]()
 except Exception: pass
 def f2_1(): pass
 def f2_2(): pass
 funcs = f2_1, f2_2
 for i in range(200):
 try: funcs[i % 2]()
 except Exception: pass

"""
footer = """
for x in range(150):
 f1()
"""
num_tries = 111
body_lines = []
for y in range(12):
 for x in range(num_tries):
 body_lines.append(f" try:")
 body_lines.append(f" def f_{y}_{x}(): pass")
 body_lines.append(f" def g_{y}_{x}(): pass")
 body_lines.append(f" def h_{y}_{x}(): pass")
 body_lines.append(f" except TypeError: pass")
body = "\n".join(body_lines)
jit_crasher = Path("jit_crasher_02.py")
jit_crasher.write_text(header + body + footer)

Backtrace:

python: Python/optimizer_cases.c.h:2337: optimize_uops: Assertion `sym_matches_type(callable, &PyFunction_Type)' failed.
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 0x00007ffff7c4579e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff7c288cd in __GI_abort () at ./stdlib/abort.c:73
#5 0x00007ffff7c28830 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:118
#6 0x00007ffff7c3be1f in __assert_fail (assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:127
#7 0x00005555558ad089 in optimize_uops (co=0x555556be7f90, trace=trace@entry=0x7fffffff85a0, trace_len=trace_len@entry=25, curr_stacklen=curr_stacklen@entry=4,
 dependencies=dependencies@entry=0x7fffffff8580) at Python/optimizer_cases.c.h:2337
#8 0x00005555558af10b in _Py_uop_analyze_and_optimize (frame=frame@entry=0x7ffff7baf018, buffer=buffer@entry=0x7fffffff85a0, length=length@entry=25, curr_stacklen=curr_stacklen@entry=4,
 dependencies=dependencies@entry=0x7fffffff8580) at Python/optimizer_analysis.c:704
#9 0x00005555558a5e07 in uop_optimize (frame=frame@entry=0x7ffff7baf018, instr=instr@entry=0x555556be80ae, exec_ptr=exec_ptr@entry=0x7fffffffd148, curr_stackentries=4,
 progress_needed=progress_needed@entry=false) at Python/optimizer.c:1284
#10 0x00005555558a633d in _PyOptimizer_Optimize (frame=0x7ffff7baf018, start=0x555556be80ae, executor_ptr=0x7fffffffd148, chain_depth=1) at Python/optimizer.c:130
#11 0x00007ffff7fa50ef in ?? ()
#12 0x00007fffffffd460 in ?? ()
#13 0x00007ffff7ba8278 in ?? ()
#14 0x00007fffffffd460 in ?? ()
#15 0x00007ffff7ba7017 in ?? ()
#16 0x0000555555eebd90 in ?? ()
#17 0x00007ffff7ba7000 in ?? ()
#18 0x0000555555ccb240 in _PyRuntime ()
#19 0x00007ffff7baf018 in ?? ()
#20 0x00007ffff7bb6d88 in ?? ()
#21 0x00005555557ca560 in _PyEval_EvalFrameDefault (tstate=0x0, frame=0x555555ccb240 <_PyRuntime+331136>, throwflag=32767) at Python/generated_cases.c.h:5600
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Output of running with PYTHON_LLTRACE=4: optimize_uops_lltrace.txt.

Output of running with PYTHON_OPT_DEBUG=4:

out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
 0 abs: _START_EXECUTOR (0, target=44, operand0=0x607912642aa8, operand1=0x7ffdb8109990) stack_level 2
 1 abs: _MAKE_WARM (0, target=0, operand0=0, operand1=0) stack_level 2
 2 abs: _CHECK_VALIDITY (0, target=44, operand0=0, operand1=0xb810eab8) stack_level 2
 3 abs: _SET_IP (0, target=44, operand0=0x607912642aa8, operand1=0) stack_level 2
 4 abs: _CHECK_PERIODIC (0, target=44, operand0=0, operand1=0x7ffdb81097c8, error_target=0) stack_level 2
 5 abs: _CHECK_VALIDITY (0, target=21, operand0=0, operand1=0x76c7fa5e0f6e) stack_level 2
 6 abs: _SET_IP (0, target=21, operand0=0x607912642a7a, operand1=0x2) stack_level 2
 7 abs: _ITER_CHECK_RANGE (23, target=21, operand0=0, operand1=0x60790b01da42) stack_level 2
 8 abs: _GUARD_NOT_EXHAUSTED_RANGE (23, target=21, operand0=0, operand1=0x58) stack_level 2
 9 abs: _ITER_NEXT_RANGE (23, target=21, operand0=0, operand1=0x60790b14220d, error_target=0) out of space for symbolic expression type
 stack_level 3
Out of space in abstract interpreter
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
 0 abs: _START_EXECUTOR (0, target=91, operand0=0x607912642b06, operand1=0x7ffdb8109990) stack_level 2
 1 abs: _MAKE_WARM (0, target=0, operand0=0, operand1=0) stack_level 2
 2 abs: _CHECK_VALIDITY (0, target=91, operand0=0, operand1=0) stack_level 2
 3 abs: _SET_IP (0, target=91, operand0=0x607912642b06, operand1=0x7ffdb81097c8) stack_level 2
 4 abs: _CHECK_PERIODIC (0, target=91, operand0=0, operand1=0x76c7fa5e0f6e, error_target=0) stack_level 2
 5 abs: _CHECK_VALIDITY (0, target=68, operand0=0, operand1=0x60790b01da42) stack_level 2
 6 abs: _SET_IP (0, target=68, operand0=0x607912642ad8, operand1=0x58) stack_level 2
 7 abs: _ITER_CHECK_RANGE (23, target=68, operand0=0, operand1=0x60790b14220d) stack_level 2
 8 abs: _GUARD_NOT_EXHAUSTED_RANGE (23, target=68, operand0=0, operand1=0x76c7f9922200) stack_level 2
 9 abs: _ITER_NEXT_RANGE (23, target=68, operand0=0, operand1=0, error_target=0) out of space for symbolic expression type
 stack_level 3
Out of space in abstract interpreter
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
out of space for symbolic expression type
 0 abs: _START_EXECUTOR (0, target=39, operand0=0x607912642a9e, operand1=0x7ffdb810e140) stack_level 4
 1 abs: _MAKE_WARM (0, target=0, operand0=0, operand1=0x7ffdb810e250) stack_level 4
 2 abs: _CHECK_VALIDITY (0, target=39, operand0=0, operand1=0x180000000001) stack_level 4
 3 abs: _SET_IP (0, target=39, operand0=0x607912642a9e, operand1=0x607911a78b80) stack_level 4
 4 abs: _CHECK_PEP_523 (0, target=39, operand0=0, operand1=0) stack_level 4
 5 abs: _CHECK_FUNCTION_VERSION (0, target=39, operand0=0x775, operand1=0x607912642b06) stack_level 4
python: Python/optimizer_cases.c.h:2337: optimize_uops: Assertion `sym_matches_type(callable, &PyFunction_Type)' failed.
Aborted (core dumped)

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.0a0 (heads/main:3964f974894, Aug 14 2025, 09:18:49) [GCC 14.2.0]

Metadata

Metadata

Labels

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

      AltStyle によって変換されたページ (->オリジナル) /