Bug 114379 - crash while calling pthread_cancel when creating more then 255 threads
crash while calling pthread_cancel when creating more then 255 threads
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2004-01-27 09:36 EST by Yuval Carmel
Modified: 2007-04-18 13:02 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-01-28 12:07:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Yuval Carmel 2004-01-27 09:36:11 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET 
CLR 1.1.4322)

Description of problem:
The following program crash when creating more then 254 threads.
When using LD_ASSUME_KERNEL=2.2.5 the program works fine.

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/errno.h>

void * sleeping(void * arg)
	return 0;

int main(int argc, char *argv[])
	int i, j, rc, num_threads;
	pthread_t *tid;

	num_threads = atoi(argv[1]);

	tid = (pthread_t *)malloc(num_threads * sizeof(pthread_t));
	for ( i = 0; i < num_threads; i++)
        	rc = pthread_create(&tid[i], NULL, sleeping, (void *)
		if(rc == EAGAIN)

	printf("%d", i);

	for(j = 0; j < i; j++)

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.compile under 2.4.18-14 (RH8)
2.run the program under 2.4.20 (RH9) and it will crash

Actual Results:  crash

Additional info:
Comment 1 Jakub Jelinek 2004-01-28 12:07:23 EST
Please note that the default thread stack size is usually 8M or 10M.
You can easily do the math.  Default thread size on IA-32 is ulimit -s
value, unless it is unlimited, in which case it is 8MB.
I can run (on FC1) up to 305 threads without tweaking thread stack sizes.
They can be tweaked either by running the program with different
ulimit -s, or through pthread_attr_{setstack,setstacksize}.
Hope this helps.

Note You need to log in before you can comment on or make changes to this bug.