[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#673596: libc6: FTBFS on wheezy/sid amd64 (test suite failures)



On Wed, May 30, 2012 at 02:22:00AM -0500, Jonathan Nieder wrote:
> Thibaut Girka wrote:
> 
> > Well, no, after a quick inspection, it appears the test behaves correctly.
> > Then, I have no idea why it would fail.
> 
> Thanks.  Ok, a new test to try:
> 
>  # get the source:
>  git clone git://sourceware.org/git/glibc.git
[...]
> If it reproduces the problem, then that would mean this is not Debian-
> specific, so please write to libc-help@sourceware.org in that case to
> request advice[1].  (If we are lucky, someone might recognize the bug or
> know of some command like "strace -f" or patch that could help track
> it down.)

I'll try that.

In the meantime, I've came up with a simpler (only one spawner, no signal handling)
test (attached) that exhibits the same issue.
It appears that, for some reason, at some point in time, the threads aren't cleaned up anymore
(just monitor /proc/$pid/task when the test is running), even though the pthread_join calls succeed...
This isn't always reproductible, but it happens fairly often.

Regards,
Thibaut Girka.
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/types.h>
#include <unistd.h>

#define NB_THREADS	20

void *thread_func(void *arg)
{
	return arg;
}


int main(void)
{
	unsigned int i = 0, j;
	void *result;
	pthread_t threads[NB_THREADS];

	printf("Please watch /proc/%d/task as I'm running!\n", getpid());

	/* Pre-spawn NB_THREAD threads */
	for (j = 0; j < NB_THREADS; j++)
	{
		if (pthread_create(&threads[j], NULL, thread_func, (void *) j) != 0)
		{
			perror("pthread_create");
			return 1;
		}
	}

	/* Now, close one thread, spawn another. FIFO style. */
	while(1)
	{
		if (pthread_join(threads[i % NB_THREADS], &result) != 0)
		{
			perror("pthread_join");
			break;
		}
		if ((unsigned int) result != (i % NB_THREADS))
		{
			printf("Invalid reslut: %d!\n", (unsigned int) result);
			break;
		}
		if (pthread_create(&threads[i % NB_THREADS], NULL, thread_func, (void *) (i % NB_THREADS)) != 0)
		{
			perror("pthread_create");
			break;
		}
		i += 1;
		if (i % 50000 == 0)
			printf("%d threads created\n", i);
	}

	printf("%d threads created\n", i);

	return 0;
}

Attachment: signature.asc
Description: Digital signature


Reply to: