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

Bug#191395: marked as done (clone(...) makes defunct threads when linked with pthread)



Your message dated Fri, 02 May 2003 20:36:39 +0900
with message-id <807k99y3zs.wl@oris.opensource.jp>
and subject line Bug#191395: clone(...) makes defunct threads when linked with pthread
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 30 Apr 2003 09:43:07 +0000
>From bird@cs.auc.dk Wed Apr 30 04:43:04 2003
Return-path: <bird@cs.auc.dk>
Received: from mailhost.cs.auc.dk [130.225.194.6] (root)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 19Ao7D-0001pQ-00; Wed, 30 Apr 2003 04:43:03 -0500
Received: from blade48.cs.auc.dk (bird@blade48.cs.auc.dk [130.225.194.133])
	by mailhost.cs.auc.dk (8.12.3/8.12.3) with ESMTP id h3U9gvVR015261
	for <submit@bugs.debian.org>; Wed, 30 Apr 2003 11:42:57 +0200 (MEST)
Date: Wed, 30 Apr 2003 11:42:57 +0200 (MEST)
From: Christian Thomsen <bird@cs.auc.dk>
To: submit@bugs.debian.org
Subject: clone(...) makes defunct threads when linked with pthread
Message-ID: <Pine.GSO.4.44.0304301032450.14312-100000@blade48.cs.auc.dk>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Scanned-By: MIMEDefang 2.14
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=-11.7 required=4.0
	tests=BAYES_01,HAS_PACKAGE,USER_AGENT_PINE
	autolearn=ham version=2.53-bugs.debian.org_2003_04_23
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_04_23 (1.174.2.15-2003-03-30-exp)

Package: libc6-dev
Version: 2.2.5-11.2
Severity: normal



-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux splint 2.4.20 #2 Fri Apr 11 18:38:04 CEST 2003 i686
Locale: LANG=C, LC_CTYPE=C


The problem is that if the c-program below is compiled with gcc 2.95.3:
gcc libc_bug.c -o test
then it makes 10 threads and they function allright!

But if I compile with:
gcc -lpthread libc_bug.c -o test
then the call to clone returns the pid of the child (no error but the
actual thread pid), and the thread is created but is defunct, and the
specified method is never called!!

Now the Really strange part if I compile with:

gcc /usr/lib/libpthread.a libc_bug.c -o test
then it works just fine???


The problem has also been identified on a system using libc-dev 2.2.5-11.5
running kernel 2.4.19

I have degenerated, and tried the below program on a RedHat machine
running kernel 2.4.18 , gcc 2.96 and libc6-dev 2.2.4-13
On this machine there are no problems when linking both dynamic and static
with pthreads......



 //program

#include <sched.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

#define STACK_SIZE      16384

int dummy(void *_arg) {
        int p = *(int*)_arg;
        fprintf(stderr,"Child has pid = %d \n", getpid());
        sleep(100);
        return 0;
}


int main(int argc, char *argv) {
        void *stack;
        int pid;
        int arg;
        int i;
        for (i=0; i<10; i++) {
                //make stack
                stack = malloc(STACK_SIZE);
                //stack grows down
                stack = (void*)((unsigned int)stack + STACK_SIZE);
                arg = i;
                pid = clone(dummy, stack, CLONE_FS | CLONE_FILES | CLONE_VM | CLONE_SIGHAND, (void*)&arg);
                fprintf(stderr,"Main created Thread with pid %d \n", pid);
                sleep(1);
        } // end forloop
        while(1) {
                sleep(10);
        }
        return 0;
}








/Christian Thomsen
/DAT 8
/Aalborg Universitet
/Denmark


---------------------------------------
Received: (at 191395-done) by bugs.debian.org; 2 May 2003 11:36:44 +0000
>From gotom@debian.or.jp Fri May 02 06:36:41 2003
Return-path: <gotom@debian.or.jp>
Received: from oris.opensource.jp (oris.opensource.gr.jp) [218.44.239.73] (postfix)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 19BYqG-0007Gt-00; Fri, 02 May 2003 06:36:40 -0500
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.73])
	by oris.opensource.gr.jp (Postfix) with ESMTP
	id 4CF31C33C6; Fri,  2 May 2003 20:36:39 +0900 (JST)
Date: Fri, 02 May 2003 20:36:39 +0900
Message-ID: <807k99y3zs.wl@oris.opensource.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: Christian Thomsen <bird@cs.auc.dk>, 191395-done@bugs.debian.org
Subject: Re: Bug#191395: clone(...) makes defunct threads when linked with pthread
In-Reply-To: <Pine.GSO.4.44.0304301032450.14312-100000@blade48.cs.auc.dk>
References: <Pine.GSO.4.44.0304301032450.14312-100000@blade48.cs.auc.dk>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 191395-done@bugs.debian.org
X-Spam-Status: No, hits=-20.0 required=4.0
	tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,
	      REFERENCES,REPLY_WITH_QUOTES,USER_AGENT
	autolearn=ham version=2.53-bugs.debian.org_2003_04_23
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_04_23 (1.174.2.15-2003-03-30-exp)

At Wed, 30 Apr 2003 11:42:57 +0200 (MEST),
Christian Thomsen wrote:
> The problem is that if the c-program below is compiled with gcc 2.95.3:
> gcc libc_bug.c -o test
> then it makes 10 threads and they function allright!
(snip)
>  //program
> 
> #include <sched.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> 
> #define STACK_SIZE      16384
> 
> int dummy(void *_arg) {
>         int p = *(int*)_arg;
>         fprintf(stderr,"Child has pid = %d \n", getpid());
>         sleep(100);
>         return 0;
> }
> int main(int argc, char *argv) {
>         void *stack;
>         int pid;
>         int arg;
>         int i;
>         for (i=0; i<10; i++) {
>                 //make stack
>                 stack = malloc(STACK_SIZE);

recommend to use valloc();

>                 //stack grows down
>                 stack = (void*)((unsigned int)stack + STACK_SIZE);
>                 arg = i;
>                 pid = clone(dummy, stack, CLONE_FS | CLONE_FILES | CLONE_VM | CLONE_SIGHAND, (void*)&arg);

&stack

>                 fprintf(stderr,"Main created Thread with pid %d \n", pid);
>                 sleep(1);
>         } // end forloop
>         while(1) {
>                 sleep(10);
>         }
>         return 0;
> }

Regards,
-- gotom



Reply to: