This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[cguerra@workfire.com] libc/1252: LinuxThread bug wrt pthread_create




We've received the appended bug report.  Could anybody look into it,
please?

Thanks,
Andreas



Topics:
   libc/1252: LinuxThread bug wrt pthread_create


----------------------------------------------------------------------

Date: Thu, 12 Aug 1999 09:57:46 -0700
From: cguerra@workfire.com
To: bugs@gnu.org
Subject: libc/1252: LinuxThread bug wrt pthread_create
Message-Id: <199908121657.JAA01254@15.workfire.com>


>Number:         1252
>Category:       libc
>Synopsis:       pthread_create() will hang if too many threads are created
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    libc-gnats
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Thu Aug 12 13:10:06 EDT 1999
>Last-Modified:
>Originator:     users
>Organization:
Workfire Development Corp
>Release:        libc-2.1.1
>Environment:
	
Host type: i386-redhat-linux-gnu
System: Linux 15.workfire.com 2.2.11 #2 Tue Aug 10 09:50:19 PDT 1999 i686 unknown
Architecture: i686

Addons: crypt glibc-compat linuxthreads
Build CFLAGS: -g -O3
Build CC: egcs
Compiler version: egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Kernel headers: 2.2.11
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio

>Description:

I was running a test of the pthreads library under glibc-2.1.1 and
LinuxThreads-2.1.1 (RedHat 6.0), and glibc-2.0.7.  The test was to
create threads until pthread_create() returns an error.  On the system
described above (RedHat 6.0), the library seems to hang after trying
to create (what should be) the last thread.  The main program thread
is stuck in suspend() (inside the call to pthread_create()) and the
manager thread causes an error attempting to access the stack for the
new thread.  That is, inside pthread_handle_create(), the manager
calls pthread_allocate_stack() and then tries to access the data
structure for the new thread (on the newly allocated stack) and that
causes an access violation.

Using the older 2.0.7 version of glibc/linuxthreads this problem does
not occur and the error is reported.

>How-To-Repeat:

Here is some sample code:

/* 
 * Build with: 
 * gcc -D_REENTRANT -g -Wall -o pthreadTest pthreadTest.c -lpthread
 */
/*
 * 1999 08 09 - cjg - pthreadTest.c
 *
 * This file is a test of the pthread_create() routine under the glibc-2.1.1
 * libraries.
 */

#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <bits/local_lim.h>

void *childThread(void *);

int main(int argc, char *argv[])
{
    pthread_t myThread;
    int i;
    int result;

    /* Attempt to create more threads than is possible */
    for(i=0;i<=PTHREAD_THREADS_MAX;i++)
    {
	result = pthread_create(&myThread, NULL, childThread, (void *)i);
	if( result != 0 )
	{
	    printf("Couldn't create thread %d\n", i+1);
	    break;
	}

	/* printf("Created thread %ld\n", myThread); */
    }/* for */

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

    return(0);
}/* main */

void *childThread(void *pData)
{
    int num = (int)pData;

    /* printf("Thread %d started successfully\n", num); */

    /* Try each thread alive long enough to have all the threads in memory */
    sleep(20);

    return(NULL);
}/* childThread */


>Fix:

No fix suggested.





>Audit-Trail:
>Unformatted:


------------------------------

End of forwardlnBnPV Digest
***************************



-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]