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

Appearance settings

test_sys_settrace segfaults on main #109143

Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
@JelleZijlstra

Description

@JelleZijlstra
Issue body actions

Crash report

On clean main:

% ./python.exe -m test -R 3:3 test_sys_settrace
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.44 Run tests sequentially
0:00:00 load avg: 2.44 [1/1] test_sys_settrace
beginning 6 repetitions
123456
...Fatal Python error: Segmentation fault

Current thread 0x00000001fd5ade00 (most recent call first):
  File "/Users/jelle/py/cpython/Lib/test/test_sys_settrace.py", line 1912 in trace
  File "/Users/jelle/py/cpython/Lib/test/test_sys_settrace.py", line 2162 in test_jump_backwards_into_while_block
  File "/Users/jelle/py/cpython/Lib/test/test_sys_settrace.py", line 1975 in run_test
  File "/Users/jelle/py/cpython/Lib/test/test_sys_settrace.py", line 2008 in test
  File "/Users/jelle/py/cpython/Lib/unittest/case.py", line 589 in _callTestMethod
  File "/Users/jelle/py/cpython/Lib/unittest/case.py", line 634 in run
  File "/Users/jelle/py/cpython/Lib/unittest/case.py", line 690 in __call__
  File "/Users/jelle/py/cpython/Lib/unittest/suite.py", line 122 in run
  File "/Users/jelle/py/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/jelle/py/cpython/Lib/unittest/suite.py", line 122 in run
  File "/Users/jelle/py/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/jelle/py/cpython/Lib/unittest/suite.py", line 122 in run
  File "/Users/jelle/py/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/jelle/py/cpython/Lib/test/support/testresult.py", line 146 in run
  File "/Users/jelle/py/cpython/Lib/test/support/__init__.py", line 1141 in _run_suite
  File "/Users/jelle/py/cpython/Lib/test/support/__init__.py", line 1268 in run_unittest
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 393 in run_unittest
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 447 in test_func
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/refleak.py", line 91 in dash_R
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 405 in regrtest_runner
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 451 in _load_run_test
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 491 in _runtest_env_changed_exc
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 348 in _runtest
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/runtest.py", line 375 in runtest
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 462 in run_test
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 495 in run_tests_sequentially
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 632 in run_tests
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 855 in action_run_tests
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 883 in _main
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 822 in main
  File "/Users/jelle/py/cpython/Lib/test/libregrtest/main.py", line 891 in main
  File "/Users/jelle/py/cpython/Lib/test/__main__.py", line 2 in <module>
  File "/Users/jelle/py/cpython/Lib/runpy.py", line 88 in _run_code
  File "/Users/jelle/py/cpython/Lib/runpy.py", line 198 in _run_module_as_main

Extension modules: _testcapi (total: 1)
zsh: segmentation fault  ./python.exe -m test -R 3:3 test_sys_settrace

I saw this in buildbots on my PR #109123 but it also reproduces on main for me locally.

Stack trace:

Process 47388 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
    frame #0: 0x000000010008c140 python.exe`code_richcompare(self=0x00000001025453f0, other=0x00000001025453f0, op=3) at codeobject.c:1808:39 [opt]
   1805	
   1806	        if (co_code == ENTER_EXECUTOR) {
   1807	            const int exec_index = co_arg;
-> 1808	            _PyExecutorObject *exec = co->co_executors->executors[exec_index];
   1809	            co_code = exec->vm_data.opcode;
   1810	            co_arg = exec->vm_data.oparg;
   1811	        }
Target 0: (python.exe) stopped.
warning: python.exe was compiled with optimization - stepping may behave oddly; variables may not be available.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
  * frame #0: 0x000000010008c140 python.exe`code_richcompare(self=0x00000001025453f0, other=0x00000001025453f0, op=3) at codeobject.c:1808:39 [opt]
    frame #1: 0x00000001000d2b14 python.exe`do_richcompare(tstate=0x00000001004ea308, v=0x00000001025453f0, w=0x00000001025453f0, op=3) at object.c:787:15 [opt]
    frame #2: 0x00000001000d2a64 python.exe`PyObject_RichCompare(v=0x00000001025453f0, w=0x00000001025453f0, op=3) at object.c:836:21 [opt]
    frame #3: 0x0000000100168354 python.exe`_PyEval_EvalFrameDefault(tstate=<unavailable>, frame=<unavailable>, throwflag=<unavailable>) at generated_cases.c.h:2757:19 [opt]
    frame #4: 0x000000010015e0b4 python.exe`_PyEval_EvalFrame(tstate=<unavailable>, frame=<unavailable>, throwflag=<unavailable>) at pycore_ceval.h:107:16 [opt]
    frame #5: 0x000000010015e04c python.exe`_PyEval_Vector(tstate=0x00000001004ea308, func=0x00000001036c2bd0, locals=0x0000000000000000, args=0x000000016fdfc340, argcount=4, kwnames=0x0000000000000000) at ceval.c:1632:12 [opt]
    frame #6: 0x0000000100086758 python.exe`_PyFunction_Vectorcall(func=0x00000001036c2bd0, stack=0x000000016fdfc340, nargsf=<unavailable>, kwnames=0x0000000000000000) at call.c:0:45 [opt]
    frame #7: 0x00000001000894d8 python.exe`_PyObject_VectorcallTstate(tstate=0x00000001004ea308, callable=0x00000001036c2bd0, args=0x000000016fdfc340, nargsf=4, kwnames=0x0000000000000000) at pycore_call.h:187:11 [opt]
    frame #8: 0x000000010008898c python.exe`method_vectorcall(method=<unavailable>, args=0x000000016fdfc3f0, nargsf=<unavailable>, kwnames=0x0000000000000000) at classobject.c:92:18 [opt]
    frame #9: 0x00000001001dfbc0 python.exe`_PyObject_VectorcallTstate(tstate=0x00000001004ea308, callable=0x000000010372cc50, args=0x000000016fdfc3f0, nargsf=3, kwnames=0x0000000000000000) at pycore_call.h:187:11 [opt]
    frame #10: 0x00000001001e1c34 python.exe`call_trampoline(tstate=0x00000001004ea308, callback=0x000000010372cc50, frame=0x0000000103650ef0, what=2, arg=<unavailable>) at sysmodule.c:1005:24 [opt]
    frame #11: 0x00000001001e1d8c python.exe`trace_trampoline(self=<unavailable>, frame=0x0000000103650ef0, what=2, arg=0x0000000100451758) at sysmodule.c:1042:24 [opt]
    frame #12: 0x00000001001b4c24 python.exe`_Py_call_instrumentation_line(tstate=0x00000001004ea308, frame=<unavailable>, instr=<unavailable>, prev=<unavailable>) at instrumentation.c:1173:27 [opt]

The problem is that co->co_executors is NULL. This line blames to @corona10's PR #108165.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesbugs and security fixestype-crashA hard crash of the interpreter, possibly with a core dumpA 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.