24843, "jabraham17", "[Bug]: CLS segfaults on 'modules/packages/BLAS.chpl'", "2024-04-12T20:31:01Z"
Summary of Problem
Description:
When using CLS, just opening modules/packages/BLAS.chpl
causes a segfault in the chapel python bindings. The fault occurs in used_imported_modules
and appears to be a python refcounting issue.
Commenting out the use of this function in chpl-language-server.py
is enough to work around the issue.
Steps to Reproduce
Run CLS and open modules/packages/BLAS.chpl
Stack Trace
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [18953]
VM Region Info: 0 is not in any region. Bytes before following region: 4332912640
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102430000-102434000 [ 16K] r-x/r-x SM=COW .../MacOS/Python
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 core.cpython-312-darwin.so 0x10301721c Py_DECREF(_object*) + 0 (object.h:701) [inlined]
1 core.cpython-312-darwin.so 0x10301721c PythonClassWithObject<AstNodeObject, chpl::uast::AstNode const*>::dealloc(AstNodeObject*) + 20 (python-class.h:144)
2 Python 0x102bfbc78 type_call + 332
3 Python 0x102c6e4a0 _PyObject_Call + 124
4 core.cpython-312-darwin.so 0x103068110 wrapGeneratedType(ContextObject*, chpl::uast::AstNode const*) + 2492 (uast-classes-list.h:148)
5 core.cpython-312-darwin.so 0x10301b9a0 PythonReturnTypeInfo<chpl::uast::Module const*>::wrap(ContextObject*, chpl::uast::Module const* const&) + 12 (uast-classes-list.h:148) [inlined]
6 core.cpython-312-darwin.so 0x10301b9a0 _object* wrapVector<chpl::uast::Module const*>(ContextObject*, std::__1::vector<chpl::uast::Module const*, std::__1::allocator<chpl::uast::Module const*>> const&) + 32 (python-types.h:86) [inlined]
7 core.cpython-312-darwin.so 0x10301b9a0 PythonReturnTypeInfo<std::__1::vector<chpl::uast::Module const*, std::__1::allocator<chpl::uast::Module const*>>>::wrap(ContextObject*, std::__1::vector<chpl::uast::Module const*, std::__1::allocator<chpl::uast::Module const*>> const&) + 52 (python-types.h:254) [inlined]
8 core.cpython-312-darwin.so 0x10301b9a0 _object* InvokeHelper<std::__1::vector<chpl::uast::Module const*, std::__1::allocator<chpl::uast::Module const*>> ()>::invoke<ScopeObject_used_imported_modules(_object*, _object*)::$_12>(ContextObject*, ScopeObject_used_imported_modules(_object*, _object*)::$_12&&) + 564 (core-types-gen.cpp:84) [inlined]
9 core.cpython-312-darwin.so 0x10301b9a0 ScopeObject_used_imported_modules(_object*, _object*) + 604 (core-methods.h:86)
10 Python 0x102af88f4 _PyEval_EvalFrameDefault + 50200
11 Python 0x102c66094 _PyObject_FastCallDictTstate + 96
12 Python 0x102c0a4f0 slot_tp_init + 212
13 Python 0x102bfbbc0 type_call + 148
14 Python 0x102c66954 _PyObject_MakeTpCall + 128
15 Python 0x102af7154 _PyEval_EvalFrameDefault + 44152
16 Python 0x102c0a10c gen_send_ex2 + 204
17 _asyncio.cpython-312-darwin.so 0x103d5cfbc task_step_impl + 436
18 _asyncio.cpython-312-darwin.so 0x103d5cd94 task_step + 60
19 Python 0x102c66954 _PyObject_MakeTpCall + 128
20 Python 0x102ba41bc context_run + 104
21 Python 0x102bb1278 cfunction_vectorcall_FASTCALL_KEYWORDS.llvm.5227136755015259219 + 92
22 Python 0x102af8bc4 _PyEval_EvalFrameDefault + 50920
23 Python 0x102b8e630 PyEval_EvalCode + 184
24 Python 0x102a5d1bc run_eval_code_obj.llvm.267720571373200387 + 88
25 Python 0x102ab96f0 run_mod.llvm.267720571373200387 + 132
26 Python 0x102bde5e8 pyrun_file + 148
27 Python 0x102b22ff0 _PyRun_SimpleFileObject + 288
28 Python 0x102bdd96c _PyRun_AnyFileObject + 232
29 Python 0x102c0ab90 pymain_run_file_obj + 220
30 Python 0x102a8b754 pymain_run_file + 72
31 Python 0x102c09d44 Py_RunMain + 860
32 Python 0x102b353c4 Py_BytesMain + 40
33 dyld 0x1aa83bf28 start + 2236