kpeeters / cadabra2

A field-theory motivated approach to computer algebra.
https://cadabra.science/
GNU General Public License v3.0
226 stars 37 forks source link

Ctest fails on 32-bit at Test #39: canonicalise #280

Closed badshah400 closed 1 month ago

badshah400 commented 1 year ago

When building version 2.4.4.1 for openSUSE, we see builds on 32-bit failing with the following issue when running ctest:

[  418s] 39/48 Test #39: canonicalise .....................Subprocess aborted***Exception:   1.16 sec
[  418s] free(): invalid pointer
[  418s] 
...
[  442s] 98% tests passed, 1 tests failed out of 48
[  442s] 
[  442s] Total Test time (real) = 170.28 sec
[  442s] 
[  442s] The following tests FAILED:
[  442s]     39 - canonicalise (Subprocess aborted)
[  442s] Errors while running CTest

No such problem on builds for 64-bit machines.

Libraries used:

Happy to help with any other info if required.

kpeeters commented 3 months ago

Can you run this with cadabra2 -d ../tests/canonicalise.cdb from the build folder? That will put you into the debugger from which you can get a backtrace with bt after the crash. Please paste that here.

Having said that, I suspect that this crashes somewhere in the xperm_new.cc code, and fixing that may not be easy...

badshah400 commented 1 month ago

Hi, sorry for the delay in getting back to you.

Here is what I could get from the backtrace from building the new version 2.5.4, where the issue persists. There are some debug symbols missing for dependencies, as it has been a bit cumbersome trying to do this inside the rpmbuild chroot, but I will try to get a full bt including dependency debug-infos if required.

From a quick glance, it looks like your intuition was right, the issue seems to be in canonical_perm_ext in the xperm_new.cc file:

Thread 1 "python3.11" received signal SIGABRT, Aborted.
0xf7fc6579 in __kernel_vsyscall ()
#0  0xf7fc6579 in __kernel_vsyscall ()
#1  0xf799e297 in __pthread_kill_implementation () from /lib/libc.so.6
#2  0xf794bff1 in raise () from /lib/libc.so.6
#3  0xf79332c7 in abort () from /lib/libc.so.6
#4  0xf7934381 in __libc_message_impl.cold () from /lib/libc.so.6
#5  0xf79a990d in malloc_printerr () from /lib/libc.so.6
#6  0xf79abb8b in _int_free () from /lib/libc.so.6
#7  0xf79ae263 in free () from /lib/libc.so.6
#8  0xf72926a2 in canonical_perm_ext(int*, int, int, int*, int, int*, int, int*, int, int*, int, int*, int, int*, int*, int, int*, int, int*) () from /home/abuild/rpmbuild/BUILDROOT/cadabra2-
2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#9  0xf729718e in cadabra::canonicalise::apply(tree<cadabra::str_node, std::allocator<tree_node_<cadabra::str_node> > >::pre_order_iterator&) () from /home/abuild/rpmbuild/BUILDROOT/cadabra2-
2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#10 0xf72459c8 in cadabra::Algorithm::apply_deep(tree<cadabra::str_node, std::allocator<tree_node_<cadabra::str_node> > >::pre_order_iterator&) () from /home/abuild/rpmbuild/BUILDROOT/cadabra
2-2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#11 0xf7245d38 in cadabra::Algorithm::apply_generic(tree<cadabra::str_node, std::allocator<tree_node_<cadabra::str_node> > >::pre_order_iterator&, bool, bool, unsigned int) () from /home/abui
ld/rpmbuild/BUILDROOT/cadabra2-2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#12 0xf731288b in ?? () from /home/abuild/rpmbuild/BUILDROOT/cadabra2-2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#13 0xf7312968 in std::shared_ptr<cadabra::Ex> cadabra::apply_algo<cadabra::canonicalise>(std::shared_ptr<cadabra::Ex>, bool, bool, unsigned int) () from /home/abuild/rpmbuild/BUILDROOT/cadab
ra2-2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#14 0xf731167e in ?? () from /home/abuild/rpmbuild/BUILDROOT/cadabra2-2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#15 0xf7230330 in ?? () from /home/abuild/rpmbuild/BUILDROOT/cadabra2-2.5.4-1.i386/usr/lib/python3.11/site-packages/cadabra2.cpython-311-i386-linux-gnu.so
#16 0xf7c80441 in ?? () from /lib/libpython3.11.so.1.0
#17 0xf7c66ab3 in _PyObject_MakeTpCall () from /lib/libpython3.11.so.1.0
#18 0xf7c793ab in PyObject_Vectorcall () from /lib/libpython3.11.so.1.0
#19 0xf7c6e364 in _PyEval_EvalFrameDefault () from /lib/libpython3.11.so.1.0
#20 0xf7c6abab in ?? () from /lib/libpython3.11.so.1.0
#21 0xf7ceb629 in PyEval_EvalCode () from /lib/libpython3.11.so.1.0
#22 0xf7d00d8a in ?? () from /lib/libpython3.11.so.1.0
#23 0xf7c70f79 in _PyEval_EvalFrameDefault () from /lib/libpython3.11.so.1.0

Thanks for the suggestion for debugging this.

kpeeters commented 1 month ago

I'll keep the issue open but it won't have the highest priority given that essentially all users will be on 64 bits. But thanks anyway for the backtrace.

badshah400 commented 1 month ago

Yes, I understand. 32-bit on openSUSE is also kind of on life-support AFAICT, but the seriousness typically associated with free invalid pointer made me report this. For openSUSE/Tumbleweed, we will simply disable the test instead. Thanks again.

kpeeters commented 1 month ago

Ok, thanks. Somewhat related: there is now a github workflow that builds a package for openSUSE/Tumbleweed (x86_64 only) on every release (see assets of the 2.5.4 release). This is of course just meant for people who want to stay on the bleeding edge (I would expect anyone else to get their package from the openSUSE repo instead), and for me to spot build issues before they reach you.

badshah400 commented 1 month ago

Somewhat related: there is now a github workflow that builds a package for openSUSE/Tumbleweed (x86_64 only) on every release

Yes, I noticed. That is very cool. I will get around to testing the TW package soon and shall let you know if there are any issues.

Cheers.