bug-glibc
[Top][All Lists]
Advanced

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

possible bug in pthread_create(), multiple threads created


From: Eric Sharkey
Subject: possible bug in pthread_create(), multiple threads created
Date: Mon, 10 Dec 2001 19:10:12 -0500

Hi all,

I'm trying to debug a program using Linux pthreads but I'm getting some
strange behavior which is starting to look more and more like a
bug in Linux threads itself than a bug in my own code.

The problem seems to be that from one call to pthread_create, two new
threads are created and passed the same void * pointer.  This occurs in
about one in 10,000 calls to pthread_create.  (I'm spawning threads
at a rate of about 10 to 15 Hz, but I use a semaphore to make sure
that no more than 4 child threads are running at any given moment.)

So far I have only been able to duplicate this problem on one machine,
a 4 CPU Dell PowerEdge 6400.  When I run on machines with 2 or fewer
CPUs I don't observe this behavior.  (I only have one 4-CPU box.)

I started observing this problem when I upgraded from a 2.2.x kernel
to 2.4.14 (which was the latest kernel at the time).  I've tried several
different kernel versions from 2.4.7 through 2.4.16, but they've all
shown the same behavior, unless I turned off SMP support and then it
ran fine.

I put mutex protected counters in both the main thread (to count calls to
pthread_create) and in the child threads (to count threads that actually
start) and I've seen the latter outnumber the former. 

I was just wondering if there has been any hint of a bug that could cause
pthread_create to cause multiple threads from a single call. 

Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]