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) { sleep(1000); 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 *) 0); if(rc == EAGAIN) break; } printf("%d", i); for(j = 0; j < i; j++) pthread_cancel(tid[j]); exit(0); } Version-Release number of selected component (if applicable): kernel-2.4.20-8 How reproducible: Always Steps to Reproduce: 1.compile under 2.4.18-14 (RH8) 2.run the program under 2.4.20 (RH9) and it will crash 3. Actual Results: crash Additional info:
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.