There is a potential segmentation fault when executing ‘make test’ while building apr-1.7.0. The following lines are output:
... testatomic : -Line 413: Failed creating threads -/bin/sh: line 2: XXXXX Segmentation fault ./$prog -v ... Programs failed: testall make: *** [check] Error 139 make: Leaving directory `.../apr-1.7.0/test' make: *** [check] Error 2
The segmentation fault is caused by a call to
apr_thread_join() on an invalid
apr_thread_t instance in
test_atomics_threaded(). The problematic functions,
test_atomics_threaded64(), continue processing even when
apr_thread_create() returns an error value.
The segmentation fault is avoided and the remaining tests are executed if either of the following is performed on …/apr-1.7.0/test/testatomic.c:
1. Comment out the following lines:
abts_run_test(suite, test_atomics_threaded, NULL); abts_run_test(suite, test_atomics_threaded64, NULL);
2. Update NUM_THREADS with a smaller number, for example:
#define NUM_THREADS 25
A lack of memory resources is the underlying cause of this segmentation fault. Reducing the number of threads created for these tests allows testing the atomic operations as intended.