This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix sporadic failure in tst-eintr1 test case
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Thu, 20 Sep 2012 14:15:57 +0530
- Subject: [PATCH] Fix sporadic failure in tst-eintr1 test case
Hi,
Debian has been using the attached patch to work around the race
condition within the kernel that causes sporadic failures in
tst-eintr1. A background for this can be found here:
http://sourceware.org/ml/libc-help/2012-06/msg00000.html
To summarize, the kernel calls futex_wake on the tid and wakes up the
joiner thread before it takes the underlying task off the tasklist and
hence reduces the nproc count for the user. If the machine is fast
enough, you could end up with tasks that have completed but not taken
off the list yet and the nproc limit being hit. The patch modifies the
test to write out a '!' to the output indicating that such a condition
was reached and continues the test. OK to commit?
Regards,
Siddhesh
2012-09-20 Jonathan Nieder <jrnieder@gmail.com>
* nptl/tst-eintr1.c (tf1): Tolerate EAGAIN from pthread_create.
diff --git a/nptl/tst-eintr1.c b/nptl/tst-eintr1.c
index ac381a8..b651bcb 100644
--- a/nptl/tst-eintr1.c
+++ b/nptl/tst-eintr1.c
@@ -48,6 +48,16 @@ tf1 (void *arg)
puts ("pthread_create returned EINTR");
exit (1);
}
+ if (e == EAGAIN)
+ {
+ /* The kernel might not have processed the last few
+ pthread_join()s yet. Tolerate that, but record the
+ event in test output so attentive people reading
+ logs can notice if pthread_join() stops working
+ altogether. */
+ write (STDOUT_FILENO, "!", 1);
+ continue;
+ }
char buf[100];
printf ("tf1: pthread_create failed: %s\n",