avogadrolibs: segfault in SpaceGroupTest.reduceToPrimitive via libsymspg
Avogadro version: 1.95
- Avogadrolibs: 1.95.1
- Qt: 5.15.2
**Desktop version: **
- OS: Debian GNU/Linux
- Version debian unstable (Linux 5.10.46)
- Compiler g++ 10.2.1
Describe the bug
Running tests for the Debian build of Avogadrolibs: 1.95.1, I get a segfault at SpaceGroupTest.reduceToPrimitive
To Reproduce Steps to reproduce the behavior:
- From the avogadrolibs source dir, build tests in a
run_test
subdir:
mkdir tests/run_test
cd tests/run_test
cmake -DAvogadroLibs_BINARY_DIR=/usr/include/ -Wno-dev ..
make AvogadroTests VERBOSE=1
- Then run the tests (from the
tests/run_test
dir)
./core/AvogadroTests
- See error
Expected behavior
All tests are expected to pass without error.
Screenshots A gdb backtrace reports:
...
[----------] 5 tests from SpaceGroupTest
[ RUN ] SpaceGroupTest.getSpaceGroup
[ OK ] SpaceGroupTest.getSpaceGroup (19 ms)
[ RUN ] SpaceGroupTest.reduceToPrimitive
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff798e83d in _int_malloc (av=av@entry=0x7ffff7ac4b80 <main_arena>, bytes=bytes@entry=40) at malloc.c:3609
3609 malloc.c: No such file or directory.
(gdb) bt
#0 0x00007ffff798e83d in _int_malloc (av=av@entry=0x7ffff7ac4b80 <main_arena>, bytes=bytes@entry=40) at malloc.c:3609
#1 0x00007ffff7990164 in __GI___libc_malloc (bytes=40) at malloc.c:3058
#2 0x00007ffff78cac78 in ?? () from /lib/x86_64-linux-gnu/libsymspg.so.1
#3 0x00007ffff78cb2b3 in ?? () from /lib/x86_64-linux-gnu/libsymspg.so.1
#4 0x00007ffff78c6b80 in spa_search_spacegroup () from /lib/x86_64-linux-gnu/libsymspg.so.1
#5 0x00007ffff78ba082 in det_determine_all () from /lib/x86_64-linux-gnu/libsymspg.so.1
#6 0x00007ffff78c77ae in ?? () from /lib/x86_64-linux-gnu/libsymspg.so.1
#7 0x00007ffff7f20749 in Avogadro::Core::AvoSpglib::getHallNumber (mol=..., cartTol=1.0000000000000001e-05) at ./avogadro/core/avospglib.cpp:66
#8 0x00007ffff7f20f95 in Avogadro::Core::AvoSpglib::standardizeCell (mol=..., cartTol=1.0000000000000001e-05, toPrimitive=<optimized out>, idealize=<optimized out>) at ./avogadro/core/avospglib.cpp:181
#9 0x000055555566aaac in SpaceGroupTest_reduceToPrimitive_Test::TestBody() ()
#10 0x00005555556bd297 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#11 0x00005555556b267e in testing::Test::Run() ()
#12 0x00005555556b27d5 in testing::TestInfo::Run() ()
#13 0x00005555556b2c69 in testing::TestSuite::Run() ()
#14 0x00005555556b32b2 in testing::internal::UnitTestImpl::RunAllTests() ()
#15 0x00005555556bd807 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#16 0x00005555556b2898 in testing::UnitTest::Run() ()
#17 0x0000555555621b60 in main ()
Additional context
This is with external spglib (libsymspg1) 1.16.2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
If you have other crashes, please create an issue with as much info as you have. I have ideas on a few of them and we can track them down.
#806 isn’t perfect - figuring out the correct solution will take longer - but if it fixes crashes, it’s a useful start.
Patch #806 seems to be working well enough. Not crashing anymore on SpaceGroupTest.reduceToPrimitive , https://ci.debian.net/data/autopkgtest/testing/amd64/a/avogadrolibs/15790439/log.gz
There’s a separate runtime crash related to changing the crystal cell, but I’m not certain how to reproduce it reliably. I guess it’s not related to this spglib crash anyway, certainly not in the unit tests.
I think we can consider this bug resolved by #806 .
As for the spglib segfault, it’s reproduced on the debian CI machines on amd64, arm64, i386 at https://ci.debian.net/packages/a/avogadrolibs/ https://ci.debian.net/data/autopkgtest/testing/amd64/a/avogadrolibs/15777229/log.gz https://ci.debian.net/data/autopkgtest/testing/arm64/a/avogadrolibs/15777518/log.gz
OK, let me know if there’s anything you need to to check or patch. I’ll upload avogadrolibs 1.95.1 now to check if clean builds on the Debian servers reproduce it. I guess the rest of the code is safe, so long as getHallNumber is not used.