cmake
test_error
ai_generated
partial
CMake Error: The test 'test_network' exited with code 137 (SIGKILL). This may indicate a timeout or memory exhaustion.
ID: cmake/ctest-timeout-unexpected-exit
75%Fix Rate
85%Confidence
1Evidence
2024-01-08First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.15 | active | — | — | — |
| 3.19 | active | — | — | — |
| 3.23 | active | — | — | — |
| 3.27 | active | — | — | — |
Root Cause
A CTest test was killed by the operating system, typically due to exceeding the timeout limit set by CTest or running out of memory (OOM killer).
generic中文
CTest 测试被操作系统杀死,通常是由于超过 CTest 设置的超时限制或内存不足(OOM 杀手)。
Official Documentation
https://cmake.org/cmake/help/latest/manual/ctest.1.html#optionsWorkarounds
-
80% success Increase the test timeout in CTest: ctest --timeout 600 or add set_tests_properties(test_network PROPERTIES TIMEOUT 600) in CMakeLists.txt.
Increase the test timeout in CTest: ctest --timeout 600 or add set_tests_properties(test_network PROPERTIES TIMEOUT 600) in CMakeLists.txt.
-
70% success Optimize the test to use less memory: check for memory leaks with valgrind or address sanitizer, and reduce data structures.
Optimize the test to use less memory: check for memory leaks with valgrind or address sanitizer, and reduce data structures.
-
75% success Run the test with increased resource limits: ulimit -v 4194304 (4 GB virtual memory) before launching ctest.
Run the test with increased resource limits: ulimit -v 4194304 (4 GB virtual memory) before launching ctest.
中文步骤
增加 CTest 的测试超时时间:ctest --timeout 600 或在 CMakeLists.txt 中添加 set_tests_properties(test_network PROPERTIES TIMEOUT 600)。
优化测试以减少内存使用:使用 valgrind 或地址清理器检查内存泄漏,并减少数据结构。
在启动 ctest 之前使用更高的资源限制运行测试:ulimit -v 4194304(4 GB 虚拟内存)。
Dead Ends
Common approaches that don't work:
-
Increasing system memory without adjusting CTest timeout
80% fail
If the test hangs or is slow, adding memory does not fix the timeout; the test still gets killed at the same wall-clock limit.
-
Disabling the test entirely in CTest configuration
90% fail
This hides the problem but does not resolve the underlying issue (e.g., infinite loop or resource leak). The test may be critical for CI.
-
Setting CMAKE_CTEST_TIMEOUT to 0 (infinite) globally
85% fail
Infinite timeout can cause CI pipelines to hang indefinitely if the test never completes, leading to resource exhaustion.