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]

[Leif Johansson <leifj@matematik.su.se>] libc/1323: daemon hangs subsequent calls to pthread_create



Here's another bug report which I don't know to handle.

Any ideas or comments?

Thanks,
Andreas



Topics:
   libc/1323: daemon hangs subsequent calls to pthread_create


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

Date: Fri, 24 Sep 1999 15:25:28 +0200
From: Leif Johansson <leifj@matematik.su.se>
To: bugs@gnu.org
Subject: libc/1323: daemon hangs subsequent calls to pthread_create
Message-Id: <199909241325.PAA00884@puh.matematik.su.se>


>Number:         1323
>Category:       libc
>Synopsis:       The daemon function prevents any calls to pthread_create to return
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    libc-gnats
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Fri Sep 24 09:30:01 EDT 1999
>Last-Modified:
>Originator:     Leif Johansson
>Organization:
Department of Mathematics, Stockholm University
>Release:        libc-2.1.1
>Environment:
	
Host type: i386-redhat-linux-gnu
System: Linux puh.matematik.su.se 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 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.5-15
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:
	
If a process calls daemon(0,0) before calling pthread_create to create
a thread, the call to pthread_create will not return. When I replaced
the call to daemon in my code with the daemon which comes with libroken
(from kth-krb, heimdal or arla), pthread_create works fine.
>How-To-Repeat:
#include <pthread.h>

/*
 * The code should simply terminate with an exit code of 47
 * from the child but instead it leaves two sickly threads. Some 
 * logging would easily reveal that it never gets to pthread_join.
 * remove the call to daemon avoids the problem
 */
 
static void *
doit(void *ptr)
{
  pthread_exit(ptr);
}
 
int
main()
{
  pthread_t thread;
  int i = 47;
  void *ret = NULL;
 
  daemon(0,0);
  pthread_create(&thread,NULL,&doit,&i);
  pthread_join(thread,&ret);
  exit(*(int *)ret);
}

>Fix:
Use the daemon from arla, kth-krb or heimdal (i.e from the "roken" library).
>Audit-Trail:
>Unformatted:



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

End of forward73GMip Digest
***************************



-- 
 Andreas Jaeger   
  SuSE Labs aj@suse.de	
   private aj@arthur.rhein-neckar.de

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