# 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`
- **Domain:** cmake
- **Category:** test_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## 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).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.15 | active | — | — |
| 3.19 | active | — | — |
| 3.23 | active | — | — |
| 3.27 | active | — | — |

## Workarounds

1. **Increase the test timeout in CTest: ctest --timeout 600 or add set_tests_properties(test_network PROPERTIES TIMEOUT 600) in CMakeLists.txt.** (80% success)
   ```
   Increase the test timeout in CTest: ctest --timeout 600 or add set_tests_properties(test_network PROPERTIES TIMEOUT 600) in CMakeLists.txt.
   ```
2. **Optimize the test to use less memory: check for memory leaks with valgrind or address sanitizer, and reduce data structures.** (70% success)
   ```
   Optimize the test to use less memory: check for memory leaks with valgrind or address sanitizer, and reduce data structures.
   ```
3. **Run the test with increased resource limits: ulimit -v 4194304 (4 GB virtual memory) before launching ctest.** (75% success)
   ```
   Run the test with increased resource limits: ulimit -v 4194304 (4 GB virtual memory) before launching ctest.
   ```

## Dead Ends

- **Increasing system memory without adjusting CTest timeout** — 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. (80% fail)
- **Disabling the test entirely in CTest configuration** — 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. (90% fail)
- **Setting CMAKE_CTEST_TIMEOUT to 0 (infinite) globally** — Infinite timeout can cause CI pipelines to hang indefinitely if the test never completes, leading to resource exhaustion. (85% fail)
