Skip to content

test_perf_profiler cores periodically on macOS/aarch64 #149156

@neek78

Description

@neek78

Crash report

What happened?

When running test_perf_profiler, the subprocess fails with what appears to be a bad memory access.

This doesn't happen every time, maybe 1 in 5 runs. I can't tell if it's load related (It doesn't seem to be from my extremely unscientific testing), but it does happen when running only this test suite (ie test_perf_profiler), or all the Python tests in parallel. I've also seen this happen on the MacOS build bots.

This build was configured as such -

/Volumes/devel/src/cpython-fixes/configure --with-assertions --with-pydebug --enable-safety --enable-slower-safety CC=`basename $CC`

Note that the build tree (and thus cwd when running the tests) is completely outside of the source tree (I doubt this makes a difference, but who knows).

% ./python -m test test_perf_profiler --header
Raised RLIMIT_NOFILE: 256 -> 1024
== CPython 3.15.0a8+ (heads/main:4a5d25c26c0, Apr 29 2026, 16:33:39) [Clang 22.1.4 ]
== macOS-26.4.1-arm64-arm-64bit-Mach-O little-endian
== Python build: debug
== cwd: /Volumes/devel/build/cpython-fixes.debug/build/test_python_worker_55492æ
== CPU count: 12
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests

Using random seed: 1637940672
0:00:00 load avg: 3.66 Run 1 test sequentially in a single process
0:00:00 load avg: 3.66 [1/1] test_perf_profiler
test test_perf_profiler failed -- Traceback (most recent call last):
  File "/Volumes/devel/src/cpython-fixes/Lib/test/test_perf_profiler.py", line 145, in test_trampoline_works_with_forks
    self.assertEqual(process.returncode, 0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 139 != 0

0:00:02 load avg: 3.61 [1/1/1] test_perf_profiler failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_perf_profiler

Total duration: 2.5 sec
Total tests: run=14 failures=1 skipped=5
Total test files: run=1/1 failed=1
Result: FAILURE

I codesigned the python binary for coredumping so was able to obtain this stack trace -

% lldb --core /cores/core.55510 ./python
(lldb) target create "./python" --core "/cores/core.55510"
bt
Core file '/cores/core.55510' (arm64) was loaded.
(lldb) bt
* thread #1, stop reason = ESR_EC_IABORT_EL0 (fault address: 0x10510f84c)
  * frame #0: 0x000000010510f84c
    frame #1: 0x000000010510f84c
    frame #2: 0x0000000104a4f4d0 python`py_trampoline_evaluator(ts=0x0000000104d8a360, frame=0x0000000105104140, throw=0) at perf_trampoline.c:450:12
    frame #3: 0x00000001049062e4 python`_PyEval_EvalFrame(tstate=0x0000000104d8a360, frame=0x0000000105104140, throwflag=0) at pycore_ceval.h:120:12
    frame #4: 0x0000000104906208 python`_PyEval_Vector(tstate=0x0000000104d8a360, func=0x0000000109af9790, locals=0x0000000000000000, args=0x000000016b7f2a88, argcount=0, kwnames=0x0000000000000000) at ceval.c:2124:12
    frame #5: 0x00000001046f158c python`_PyFunction_Vectorcall(func=0x0000000109af9790, stack=0x000000016b7f2a88, nargsf=9223372036854775808, kwnames=0x0000000000000000) at call.c:413:16
    frame #6: 0x00000001046efd80 python`_PyObject_VectorcallTstate(tstate=0x0000000104d8a360, callable=0x0000000109af9790, args=0x000000016b7f2a88, nargsf=9223372036854775808, kwnames=0x0000000000000000) at pycore_call.h:144:11
    frame #7: 0x00000001046f112c python`PyObject_Vectorcall(callable=0x0000000109af9790, args=0x000000016b7f2a88, nargsf=9223372036854775808, kwnames=0x0000000000000000) at call.c:327:12
    frame #8: 0x0000000104906820 python`_Py_VectorCallInstrumentation_StackRefSteal(callable=(bits = 4457469840), arguments=0x0000000105104140, total_args=0, kwnames=(bits = 1), call_instrumentation=false, frame=0x00000001051040e0, this_instr=0x0000000109c1576e, tstate=0x0000000104d8a360) at ceval.c:775:11
    frame #9: 0x000000010490e18c python`_PyEval_EvalFrameDefault(tstate=0x0000000104d8a360, frame=0x00000001051040e0, throwflag=0) at generated_cases.c.h:1846:35
(lldb) ^D

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

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

Python 3.15.0a8+ (heads/main:4a5d25c26c0, Apr 29 2026, 16:33:39) [Clang 22.1.4 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

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