Build with GMX_USE_COLVARS=NONE segfaults in MdrunTests
Summary
When configured without Colvars support, mdrun tests for GROMACS 2024.0 segfault while calling grompp
, apparently while handling mdp fields that should be handled by the colvars module. Presumably grompp
itself will segfault similarly.
Exact steps to reproduce
cmake .... -DGMX_USE_COLVARS=None
make mdrun-test
bin/mdrun-test
For developers: Why is this important?
Configuration options should work. We should also have a build in CI that tests GMX_USE_COLVARS=NONE
so that it stays working.
If this is a bug, (1) what happens, and (2) what did you expect to happen?
Unrelated test cases segfault while trying to handle colvars mdp options. They should behave gracefully.
My guess is that in this case the colvars module is not constructed, so one of the getters in the backtrace below is returning a nullptr that is dereferenced. With GMX_USE_COLVARS=NONE
, we need enough of the colvars module constructed that at least grompp can handle normal mdp files that don't include colvars settings.
Relevant input files, logs and/or screenshots
Starting program: /nethome/mabraham/git/gromacs/main/build-gcc-libstdcxx-debug/bin/mdrun-test -ntomp 2 -ntmpi 1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[==========] Running 28 tests from 7 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CompelTest
[ RUN ] CompelTest.SwapCanRun
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6daa7d4 in gmx::MDModules::initMdpTransform (this=this@entry=0x7fffffff67f8, rules=<optimized out>) at /nethome/mabraham/git/gromacs/main/src/gromacs/mdrun/mdmodules.cpp:136
136 impl_->colvars_->mdpOptionProvider()->initMdpTransform(appliedForcesScope.rules());
(gdb) bt
#0 0x00007ffff6daa7d4 in gmx::MDModules::initMdpTransform (this=this@entry=0x7fffffff67f8, rules=<optimized out>) at /nethome/mabraham/git/gromacs/main/src/gromacs/mdrun/mdmodules.cpp:136
#1 0x00007ffff67f9371 in get_ir (mdparin=<optimized out>, mdparin@entry=0x5108c0 "/nethome/mabraham/git/gromacs/main/build-gcc-libstdcxx-debug/src/programs/mdrun/tests/Testing/Temporary/CompelTest_SwapCanRun_input.mdp", mdparout=<optimized out>,
mdModules=mdModules@entry=0x7fffffff67f8, ir=ir@entry=0x7fffffff6e40, opts=opts@entry=0x7fffffff6a40, writeMdpHeader=writeMdpHeader@entry=WriteMdpHeader::yes, wi=0x7fffffff6900) at /nethome/mabraham/git/gromacs/main/src/gromacs/gmxpreprocess/readir.cpp:2657
#2 0x00007ffff6759175 in gmx_grompp (argc=<optimized out>, argv=argv@entry=0x505740) at /nethome/mabraham/git/gromacs/main/src/gromacs/gmxpreprocess/grompp.cpp:2093
#3 0x00000000004619bc in gmx::test::SimulationRunner::callGromppOnThisRank (this=0x530208, callerRef=...) at /nethome/mabraham/git/gromacs/main/src/programs/mdrun/tests/moduletest.cpp:235
#4 0x0000000000461baf in gmx::test::SimulationRunner::callGrompp (callerRef=..., this=0x530208) at /nethome/mabraham/git/gromacs/main/src/programs/mdrun/tests/moduletest.cpp:253
#5 gmx::test::SimulationRunner::callGrompp (this=this@entry=0x530208) at /nethome/mabraham/git/gromacs/main/src/programs/mdrun/tests/moduletest.cpp:266
#6 0x00000000004336e0 in gmx::test::CompelTest_SwapCanRun_Test::TestBody (this=0x5301f0) at /nethome/mabraham/git/gromacs/main/src/programs/mdrun/tests/swapcoords.cpp:109
#7 0x00007ffff551b77f in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (location=0x7ffff5526b5d "the test body", method=<optimized out>, object=0x5301f0) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2621
#8 testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=object@entry=0x5301f0, method=<optimized out>, location=location@entry=0x7ffff5526b5d "the test body")
at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2657
#9 0x00007ffff54f3e3e in testing::Test::Run (this=0x5301f0) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2696
#10 testing::Test::Run (this=0x5301f0) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2686
#11 0x00007ffff54f3ff5 in testing::TestInfo::Run (this=0x4f1b00) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2845
#12 0x00007ffff54f4127 in testing::TestSuite::Run (this=0x4d71c0) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:3004
#13 testing::TestSuite::Run (this=0x4d71c0) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2977
#14 0x00007ffff5509d19 in testing::internal::UnitTestImpl::RunAllTests (this=0x4f2850) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:5890
#15 0x00007ffff551bbff in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (location=0x7ffff552bfb8 "auxiliary test code (environments or event listeners)", method=<optimized out>, object=0x4f2850)
at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2621
#16 testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x4f2850, method=<optimized out>, location=location@entry=0x7ffff552bfb8 "auxiliary test code (environments or event listeners)")
at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:2657
#17 0x00007ffff54f4296 in testing::UnitTest::Run (this=0x7ffff555e5c0 <testing::UnitTest::GetInstance()::instance>) at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/src/gtest.cc:5455
#18 0x000000000041b3d1 in RUN_ALL_TESTS () at /nethome/mabraham/git/gromacs/main/src/external/googletest/googletest/include/gtest/gtest.h:2318
#19 main (argc=<optimized out>, argv=<optimized out>) at /nethome/mabraham/git/gromacs/main/src/testutils/unittest_main.cpp:94
Possible fixes
If you have any suggestion, or even finished fix or merge request, that's awesome!