criu/test/zdtm/transition
Adrian Reber cb8d1bec11 zdtm: retry pthread_create on EAGAIN in thread-bomb
The thread-bomb test frequently fails during setup with
pthread_create() returning EAGAIN (errno 11).  The test creates
1024 threads in a tight loop from main(), and each of those
threads immediately spawns another thread that joins its
predecessor, resulting in a burst of ~2048 simultaneous thread
creations with 64KB stacks.

This burst causes transient EAGAIN errors from clone() due to
kernel resource pressure (VMA allocator contention, temporary
memory fragmentation, etc.).  The failure is not related to hard
resource limits — ulimit, threads-max, max_map_count and cgroup
pids limits are all well above the required values.  The failure
occurs both inside and outside containers and is worse on hosts
with fewer resources.

Measured failure rates on a 16GB / 9-CPU host:
  Before fix: 65% failure rate (13/20 outside container)
  After fix:  ~2.5% failure rate (1/40), and that failure was
              a C/R issue, not a pthread_create EAGAIN

Fix this by adding a pthread_create_retry() wrapper that retries
pthread_create() up to 50 times with a 10ms delay when it returns
EAGAIN.  This gives the kernel time to reclaim resources between
attempts while keeping the total worst-case retry time under one
second per thread creation.

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Adrian Reber <areber@redhat.com>
2026-06-10 12:29:26 +01:00
..
epoll.c zdtm/transition/epoll: don't rely on errno in case of zero return 2023-04-15 21:17:21 -07:00
fifo_dyn.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
fifo_dyn.desc test: Get rid of live directory 2016-02-20 13:40:52 +03:00
fifo_loop.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
file_aio.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
file_read.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
fork.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
fork2.c test: Get rid of live directory 2016-02-20 13:40:52 +03:00
ipc.c ci: fix new codespell errors 2023-10-22 13:29:25 -07:00
ipc.desc test: Get rid of live directory 2016-02-20 13:40:52 +03:00
lazy-thp.c ci: fix new codespell errors 2023-10-22 13:29:25 -07:00
Makefile zdtm: modify rseq01 to include a thread 2023-04-15 21:17:21 -07:00
maps007.c ci: fix make indent 2023-04-15 21:17:21 -07:00
maps007.desc test: Get rid of live directory 2016-02-20 13:40:52 +03:00
maps008.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
maps008.desc test: add test for anon shmem dedup 2016-09-06 19:31:19 +03:00
netlink00.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
netlink00.desc test: Get rid of live directory 2016-02-20 13:40:52 +03:00
pid_reuse.c zdtm: check that pid-reuse does not break iterative memory dump 2018-07-09 18:26:52 +03:00
pid_reuse.desc zdtm: check that pid-reuse does not break iterative memory dump 2018-07-09 18:26:52 +03:00
pidfd_store_sk.c zdtm: add pidfd store based pid reuse test 2021-09-03 10:31:00 -07:00
pidfd_store_sk.desc zdtm: add pidfd store based pid reuse test 2021-09-03 10:31:00 -07:00
pipe_loop00.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
pipe_shared00.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
ptrace.c clang-format: do automatic comment fixups 2022-04-28 17:53:52 -07:00
ptrace.desc test: Get rid of live directory 2016-02-20 13:40:52 +03:00
rseq01.c zdtm: unregister rseq before zeroing the rseq area 2026-05-22 11:00:24 -07:00
rseq01.desc zdtm: add transition/rseq01 test for amd64 2022-04-28 17:53:52 -07:00
rseq02.c zdtm: add rseq02 transition test with NO_RESTART CS flag 2022-04-28 17:53:52 -07:00
rseq02.desc zdtm: temporary disable rseq02 test 2022-04-28 17:53:52 -07:00
shmem.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
socket-tcp.c test: Get rid of live directory 2016-02-20 13:40:52 +03:00
socket-tcp.desc join-ns: Fix join-ns zdtm test 2016-06-01 14:52:21 +03:00
socket-tcp6.c test: Get rid of live directory 2016-02-20 13:40:52 +03:00
socket-tcp6.desc join-ns: Fix join-ns zdtm test 2016-06-01 14:52:21 +03:00
socket_loop00.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00
stack.c compel: Add test to check parasite stack setup 2023-04-15 21:17:21 -07:00
thread-bomb.c zdtm: retry pthread_create on EAGAIN in thread-bomb 2026-06-10 12:29:26 +01:00
thread-bomb.desc tests: it seems 30 seconds timeout is not always enough 2026-03-25 04:31:18 +01:00
unix_sock.c Run 'make indent' on all C files 2021-09-03 10:31:00 -07:00