cmake
test_error
ai_generated
partial
CMake 错误:测试 'test_network' 以退出码 137 (SIGKILL) 退出。这可能表示超时或内存耗尽。
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%修复率
85%置信度
1证据数
2024-01-08首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.15 | active | — | — | — |
| 3.19 | active | — | — | — |
| 3.23 | active | — | — | — |
| 3.27 | active | — | — | — |
根因分析
CTest 测试被操作系统杀死,通常是由于超过 CTest 设置的超时限制或内存不足(OOM 杀手)。
English
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).
官方文档
https://cmake.org/cmake/help/latest/manual/ctest.1.html#options解决方案
-
增加 CTest 的测试超时时间:ctest --timeout 600 或在 CMakeLists.txt 中添加 set_tests_properties(test_network PROPERTIES TIMEOUT 600)。
-
优化测试以减少内存使用:使用 valgrind 或地址清理器检查内存泄漏,并减少数据结构。
-
在启动 ctest 之前使用更高的资源限制运行测试:ulimit -v 4194304(4 GB 虚拟内存)。
无效尝试
常见但无效的做法:
-
Increasing system memory without adjusting CTest timeout
80% 失败
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% 失败
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% 失败
Infinite timeout can cause CI pipelines to hang indefinitely if the test never completes, leading to resource exhaustion.