Bug#1077047: numba: FTBFS when running tests: Fatal Python error: Segmentation fault [arm64, mips64el]

Bernhard Übelacker bernhardu at mailbox.org
Tue Aug 13 23:21:48 BST 2024


> The package fails to build from source on arm64 and mips64el with
> multiple test failures that look similar at first glance. For example,
> on arm64:
> 
> Fatal Python error: Segmentation fault



Hello,
I tried to collect some more information.

I could just follow that far as a bogus pointer
gets written in NRT_MemInfo_new_varsize_dtor,
which gets later called in nrt_varsize_dtor.

Unfortunately I cannot see where this value originates from.
Below an example debugging session, after a failing build on arm64 hardware.
In below example the bogus pointer has a value of 0xf9000be0d10083ff.

Kind regards,
Bernhard




benutzer at chroot-13-trixie-arm64:~/source/numba/try1/numba-0.59.1+dfsg$ gdb -q --args python3.12
Reading symbols from python3.12...
Reading symbols from /usr/lib/debug/.build-id/d9/3d40f59d70863566375339beb0f380251a6436.debug...
(gdb) directory /home/benutzer/source/numba/try1/numba-0.59.1+dfsg
Source directories searched: /home/benutzer/source/numba/try1/numba-0.59.1+dfsg:$cdir:$cwd
(gdb) set width 0
(gdb) set pagination off
(gdb) set environment PYTHONPATH=/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/debian/python3-numba/usr/lib/python3.12/dist-packages:/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/.pybuild/cpython3_3.12_numba/build
(gdb) set environment NUMBA_DEBUGINFO=1
(gdb) set environment NUMBA_OPT=0
(gdb) b nrt.cpp:177
No source file named nrt.cpp.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (nrt.cpp:177) pending.
(gdb) b nrt_varsize_dtor
Function "nrt_varsize_dtor" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (nrt_varsize_dtor) pending.
(gdb) run numba/tests/test_array_iterators.py
Starting program: /usr/bin/python3.12 numba/tests/test_array_iterators.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Breakpoint 1.4, NRT_MemInfo_init (mi=0x2056870, data=0x18d2510, size=0, dtor=0xfffff5901f28 <pyobject_dtor>, dtor_info=0xffffe93ae7f0, external_allocator=0x0) at numba/core/runtime/nrt.cpp:177
177         if (TheMSys.stats.enabled)
(gdb) disa 1.1
(gdb) disa 1.2
(gdb) disa 1.3
(gdb) disa 1.4
(gdb) disa 1.5
(gdb) disa 1.6
(gdb) disa 1.7
(gdb) disa 1.9
(gdb) disa 1.10
(gdb) disa 1.11
(gdb) disa 1.12
(gdb) ignore 1 1
Will ignore next crossing of breakpoint 1.
(gdb) ignore 2 1
Will ignore next crossing of breakpoint 2.
(gdb) cont
Continuing.
......
Breakpoint 1.8, NRT_MemInfo_init (mi=0x29cdbd0, data=0x29bfd90, size=24, dtor=<optimized out>, dtor_info=0x0, external_allocator=0x0) at numba/core/runtime/nrt.cpp:177
177         if (TheMSys.stats.enabled)
(gdb) print mi
$1 = (NRT_MemInfo *) 0x29cdbd0
(gdb) print *mi
$2 = {refct = std::atomic<unsigned long> = { 1 }, dtor = 0xfffff5903580 <nrt_varsize_dtor(void*, size_t, void*)>, dtor_info = 0x0, data = 0x29bfd90, size = 24, external_allocator = 0x0}
(gdb) print &mi->dtor_info
$3 = (void **) 0x29cdbe0
(gdb) watch *(void **) 0x29cdbe0
Hardware watchpoint 3: *(void **) 0x29cdbe0
(gdb) display *(NRT_MemInfo *) 0x29cdbd0
1: *(NRT_MemInfo *) 0x29cdbd0 = {refct = std::atomic<unsigned long> = { 1 }, dtor = 0xfffff5903580 <nrt_varsize_dtor(void*, size_t, void*)>, dtor_info = 0x0, data = 0x29bfd90, size = 24, external_allocator = 0x0}
(gdb) cont
Continuing.

Hardware watchpoint 3: *(void **) 0x29cdbe0

Old value = (void *) 0x0
New value = (void *) 0xf9000be0d10083ff
NRT_MemInfo_new_varsize_dtor (size=24, dtor=0xf9000be0d10083ff) at numba/core/runtime/nrt.cpp:472
472         return mi;
1: *(NRT_MemInfo *) 0x29cdbd0 = {refct = std::atomic<unsigned long> = { 1 }, dtor = 0xfffff5903580 <nrt_varsize_dtor(void*, size_t, void*)>, dtor_info = 0xf9000be0d10083ff, data = 0x29bfd90, size = 24, external_allocator = 0x0}
(gdb) bt 6
#0  NRT_MemInfo_new_varsize_dtor (size=24, dtor=0xf9000be0d10083ff) at numba/core/runtime/nrt.cpp:472
#1  0x0000fffff6dbd0f0 in numba::cpython::listobj::list_constructor::_3clocals_3e::list_impl[abi:v39][abi:c8tJTC_2fWQI8IW1CiAAYKPM6RBFDjESZRVAJmaQIA](iter_28array_28int64_2c_201d_2c_20A_29_29) () at listobj.py:469
#2  0x0000fffff6db91f4 in __main__::array_iter_items[abi:v38][abi:c8tJTC_2fWwGaMLShh6CjAIxrKR0t9qKIYaQ0qDQwmMEsTAA_3d_3d](Array<long long, 1, A, mutable, aligned>) (arr=...) at test_array_iterators.py:18
#3  0x0000fffff6db9540 in cpython::__main__::array_iter_items[abi:v38][abi:c8tJTC_2fWwGaMLShh6CjAIxrKR0t9qKIYaQ0qDQwmMEsTAA_3d_3d](Array<long long, 1, A, mutable, aligned>) ()
#4  0x0000ffffeb133e20 in call_cfunc (self=0xfffff6db9380 <cpython::__main__::array_iter_items[abi:v38][abi:c8tJTC_2fWwGaMLShh6CjAIxrKR0t9qKIYaQ0qDQwmMEsTAA_3d_3d](Array<long long, 1, A, mutable, aligned>)>, locals=<optimized out>, cfunc=<built-in method array_iter_items of _dynfunc._Closure object at remote 0xffffe79cfb20>, args=<optimized out>, kws=<optimized out>) at numba/_dispatcher.cpp:745
#5  Dispatcher_call (self=self at entry=0xffffe7e9d090, args=args at entry=(<numpy.ndarray at remote 0xffffe872ccf0>,), kws=kws at entry=0x0) at numba/_dispatcher.cpp:1037
(More stack frames follow...)
(gdb) up
#1  0x0000fffff6dbd0f0 in numba::cpython::listobj::list_constructor::_3clocals_3e::list_impl[abi:v39][abi:c8tJTC_2fWQI8IW1CiAAYKPM6RBFDjESZRVAJmaQIA](iter_28array_28int64_2c_201d_2c_20A_29_29) () at listobj.py:469
469             res = []
(gdb) list
464
465     @lower_builtin(list, types.IterableType)
466     def list_constructor(context, builder, sig, args):
467
468         def list_impl(iterable):
469             res = []
470             res.extend(iterable)
471             return res
472
473         return context.compile_internal(builder, list_impl, sig, args)
(gdb) py-bt
Traceback (most recent call first):
   File "/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/numba/tests/test_array_iterators.py", line 138, in check_array_iter_items
     self.assertPreciseEqual(cfunc(arr), expected)
   File "/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/numba/tests/test_array_iterators.py", line 175, in test_array_iter
     self.check_array_iter_items(arr)
   File "/usr/lib/python3.12/unittest/case.py", line 589, in _callTestMethod
     if method() is not None:
   File "/usr/lib/python3.12/unittest/case.py", line 634, in run
     self._callTestMethod(testMethod)
   File "/usr/lib/python3.12/unittest/case.py", line 690, in __call__
     return self.run(*args, **kwds)
   File "/usr/lib/python3.12/unittest/suite.py", line 122, in run
     test(result)
   File "/usr/lib/python3.12/unittest/suite.py", line 84, in __call__
     return self.run(*args, **kwds)
   File "/usr/lib/python3.12/unittest/suite.py", line 122, in run
     test(result)
   File "/usr/lib/python3.12/unittest/suite.py", line 84, in __call__
     return self.run(*args, **kwds)
   File "/usr/lib/python3.12/unittest/runner.py", line 240, in run
     test(result)
   File "/usr/lib/python3.12/unittest/main.py", line 281, in runTests
     self.result = testRunner.run(self.test)
   File "/usr/lib/python3.12/unittest/main.py", line 105, in __init__
     self.runTests()
   File "/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/numba/tests/test_array_iterators.py", line 555, in <module>
     unittest.main()
(gdb) up
#2  0x0000fffff6db91f4 in __main__::array_iter_items[abi:v38][abi:c8tJTC_2fWwGaMLShh6CjAIxrKR0t9qKIYaQ0qDQwmMEsTAA_3d_3d](Array<long long, 1, A, mutable, aligned>) (arr=...) at test_array_iterators.py:18
18          return list(iter(arr))
(gdb) cont
Continuing.

Breakpoint 2, nrt_varsize_dtor (ptr=0x29bfd90, size=96, info=0xf9000be0d10083ff) at numba/core/runtime/nrt.cpp:444
444         if (info) {
1: *(NRT_MemInfo *) 0x29cdbd0 = {refct = std::atomic<unsigned long> = { 0 }, dtor = 0xfffff5903580 <nrt_varsize_dtor(void*, size_t, void*)>, dtor_info = 0xf9000be0d10083ff, data = 0x29bfd90, size = 96, external_allocator = 0x0}
(gdb) up
#1  0x0000fffff5903da0 in NRT_MemInfo_call_dtor (mi=0x29cdbd0) at numba/core/runtime/nrt.cpp:401
401             mi->dtor(mi->data, mi->size, mi->dtor_info);
(gdb) print mi
$4 = (NRT_MemInfo *) 0x29cdbd0
(gdb) bt 6
#0  nrt_varsize_dtor (ptr=0x29bfd90, size=96, info=0xf9000be0d10083ff) at numba/core/runtime/nrt.cpp:444
#1  0x0000fffff5903da0 in NRT_MemInfo_call_dtor (mi=0x29cdbd0) at numba/core/runtime/nrt.cpp:401
#2  0x0000fffff7fbb1f8 in NRT_decref ()
#3  0x0000fffff6db9638 in cpython::__main__::array_iter_items[abi:v38][abi:c8tJTC_2fWwGaMLShh6CjAIxrKR0t9qKIYaQ0qDQwmMEsTAA_3d_3d](Array<long long, 1, A, mutable, aligned>) ()
#4  0x0000ffffeb133e20 in call_cfunc (self=0xfffff6db9380 <cpython::__main__::array_iter_items[abi:v38][abi:c8tJTC_2fWwGaMLShh6CjAIxrKR0t9qKIYaQ0qDQwmMEsTAA_3d_3d](Array<long long, 1, A, mutable, aligned>)>, locals=<optimized out>, cfunc=<built-in method array_iter_items of _dynfunc._Closure object at remote 0xffffe79cfb20>, args=<optimized out>, kws=<optimized out>) at numba/_dispatcher.cpp:745
#5  Dispatcher_call (self=self at entry=0xffffe7e9d090, args=args at entry=(<numpy.ndarray at remote 0xffffe872ccf0>,), kws=kws at entry=0x0) at numba/_dispatcher.cpp:1037
(More stack frames follow...)
(gdb) py-bt
Traceback (most recent call first):
   File "/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/numba/tests/test_array_iterators.py", line 138, in check_array_iter_items
     self.assertPreciseEqual(cfunc(arr), expected)
   File "/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/numba/tests/test_array_iterators.py", line 175, in test_array_iter
     self.check_array_iter_items(arr)
   File "/usr/lib/python3.12/unittest/case.py", line 589, in _callTestMethod
     if method() is not None:
   File "/usr/lib/python3.12/unittest/case.py", line 634, in run
     self._callTestMethod(testMethod)
   File "/usr/lib/python3.12/unittest/case.py", line 690, in __call__
     return self.run(*args, **kwds)
   File "/usr/lib/python3.12/unittest/suite.py", line 122, in run
     test(result)
   File "/usr/lib/python3.12/unittest/suite.py", line 84, in __call__
     return self.run(*args, **kwds)
   File "/usr/lib/python3.12/unittest/suite.py", line 122, in run
     test(result)
   File "/usr/lib/python3.12/unittest/suite.py", line 84, in __call__
     return self.run(*args, **kwds)
   File "/usr/lib/python3.12/unittest/runner.py", line 240, in run
     test(result)
   File "/usr/lib/python3.12/unittest/main.py", line 281, in runTests
     self.result = testRunner.run(self.test)
   File "/usr/lib/python3.12/unittest/main.py", line 105, in __init__
     self.runTests()
   File "/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/numba/tests/test_array_iterators.py", line 555, in <module>
     unittest.main()
(gdb) next
448             dtor(ptr);
1: *(NRT_MemInfo *) 0x29cdbd0 = {refct = std::atomic<unsigned long> = { 0 }, dtor = 0xfffff5903580 <nrt_varsize_dtor(void*, size_t, void*)>, dtor_info = 0xf9000be0d10083ff, data = 0x29bfd90, size = 96, external_allocator = 0x0}
(gdb)

Program received signal SIGBUS, Bus error.
0x00000be0d10083ff in ?? ()
1: *(NRT_MemInfo *) 0x29cdbd0 = {refct = std::atomic<unsigned long> = { 0 }, dtor = 0xfffff5903580 <nrt_varsize_dtor(void*, size_t, void*)>, dtor_info = 0xf9000be0d10083ff, data = 0x29bfd90, size = 96, external_allocator = 0x0}
(gdb) kill
Kill the program being debugged? (y or n) y
[Inferior 1 (process 584) killed]
(gdb) q
benutzer at chroot-13-trixie-arm64:~/source/numba/try1/numba-0.59.1+dfsg$




gdb -q --args python3.12
directory /home/benutzer/source/numba/try1/numba-0.59.1+dfsg
set width 0
set pagination off
set environment PYTHONPATH=/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/debian/python3-numba/usr/lib/python3.12/dist-packages:/home/benutzer/source/numba/try1/numba-0.59.1+dfsg/.pybuild/cpython3_3.12_numba/build
set environment NUMBA_DEBUGINFO=1
set environment NUMBA_OPT=0
b nrt.cpp:177
y
b nrt_varsize_dtor
y
run numba/tests/test_array_iterators.py
disa 1.1
disa 1.2
disa 1.3
disa 1.4
disa 1.5
disa 1.6
disa 1.7
disa 1.9
disa 1.10
disa 1.11
disa 1.12
ignore 1 1
ignore 2 1
cont



More information about the debian-science-maintainers mailing list