Debian Bug report logs - #581700
[libphobos-4.1-dev] Not started Threads cause Segfault on exit

version graph

Package: libphobos-4.1-dev; Maintainer for libphobos-4.1-dev is (unknown);

Reported by: Daniel Gibson <metalcaedes@gmail.com>

Date: Sat, 15 May 2010 01:51:02 UTC

Severity: normal

Found in version gdc-4.1/0.25-20080616-4.1.2-27

Fixed in version 0.25-20080616-4.1.2-27+rm

Done: Sandro Tosi <morph@debian.org>

Bug is archived. No further changes may be made.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#581700; Package libphobos-4.1-dev. (Sat, 15 May 2010 01:51:05 GMT) (full text, mbox, link).


Acknowledgement sent to Daniel Gibson <metalcaedes@gmail.com>:
New Bug report received and forwarded. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sat, 15 May 2010 01:51:05 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Daniel Gibson <metalcaedes@gmail.com>
To: submit@bugs.debian.org
Subject: [libphobos-4.1-dev] Not started Threads cause Segfault on exit
Date: Sat, 15 May 2010 03:48:22 +0200
[Message part 1 (text/plain, inline)]
Package: libphobos-4.1-dev
Version: 0.25-4.1.2-27
Severity: normal


Hi,

While trying to narrow down another bug (#581698) I noticed that my
program segfaults on exit, if there are Thread-objects that haven't
been start()ed.
While it probably doesn't make much sense to create Threads and not
start them, this shouldn't happen.
I ran it with gdb and got the following backtrace:

Program received signal SIGSEGV, Segmentation fault.
0xb7f6292b in pthread_detach () from /lib/i686/cmov/libpthread.so.0
(gdb) bt
#0  0xb7f6292b in pthread_detach () from /lib/i686/cmov/libpthread.so.0
#1  0x0805ad93 in _d_callfinalizer ()
#2  0x0805c5a6 in _D3gcx3Gcx11fullcollectMFPvZk ()
#3  0x0805ca54 in _D3gcx3Gcx16fullcollectshellMFZk ()
#4  0x0805cd8c in _D3gcx2GC18fullCollectNoStackMFZv ()
#5  0x0805a203 in gc_term ()
#6  0x0806166a in _d_run_main ()
#7  0x0805e33a in main ()

I think (but haven't tried to fix that yet) that the error is in
Thread's destructor (std/thread.d line 589/590):

if (state != TS.FINISHED)
    pthread_detach(id);

The status of an unstarted Thread is TS.INITIAL - I don't know if it
is necessary to pthread_detach() a thread that hasn't run,
but if it isn't I'd suggest to change this to

if(state != TS.FINISHED && state != TS.INITIAL)
    pthread_detach(id);

This Bug also applies gdc-4.3 and Digitalmars dmd.
I've attached a simple example to demonstrate the bug.

Cheers,
- Daniel


--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.32-3-686

Debian Release: squeeze/sid
  500 testing         security.debian.org
  500 testing         ftp.de.debian.org

--- Package information. ---
Depends                (Version) | Installed
================================-+-==================
gdc-4.1        (= 0.25-4.1.2-27) | 0.25-4.1.2-27
zlib1g-dev        (>= 1:1.2.3.3) | 1:1.2.3.4.dfsg-3


Package's Recommends field is empty.

Package's Suggests field is empty.
[phobos_bug.d (text/x-dsrc, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#581700; Package libphobos-4.1-dev. (Sat, 15 May 2010 19:48:05 GMT) (full text, mbox, link).


Acknowledgement sent to Iain Buclaw <ibuclaw@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sat, 15 May 2010 19:48:05 GMT) (full text, mbox, link).


Message #10 received at 581700@bugs.debian.org (full text, mbox, reply):

From: Iain Buclaw <ibuclaw@ubuntu.com>
To: Daniel Gibson <metalcaedes@gmail.com>, 581700@bugs.debian.org
Subject: Re: Bug#581700: [libphobos-4.1-dev] Not started Threads cause Segfault on exit
Date: Sat, 15 May 2010 20:46:36 +0100
[Message part 1 (text/plain, inline)]
On 15 May 2010 02:48, Daniel Gibson <metalcaedes@gmail.com> wrote:

> Package: libphobos-4.1-dev
> Version: 0.25-4.1.2-27
> Severity: normal
>
>
> Hi,
>
> While trying to narrow down another bug (#581698) I noticed that my
> program segfaults on exit, if there are Thread-objects that haven't
> been start()ed.
> While it probably doesn't make much sense to create Threads and not
> start them, this shouldn't happen.
> I ran it with gdb and got the following backtrace:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7f6292b in pthread_detach () from /lib/i686/cmov/libpthread.so.0
> (gdb) bt
> #0  0xb7f6292b in pthread_detach () from /lib/i686/cmov/libpthread.so.0
> #1  0x0805ad93 in _d_callfinalizer ()
> #2  0x0805c5a6 in _D3gcx3Gcx11fullcollectMFPvZk ()
> #3  0x0805ca54 in _D3gcx3Gcx16fullcollectshellMFZk ()
> #4  0x0805cd8c in _D3gcx2GC18fullCollectNoStackMFZv ()
> #5  0x0805a203 in gc_term ()
> #6  0x0806166a in _d_run_main ()
> #7  0x0805e33a in main ()
>
> I think (but haven't tried to fix that yet) that the error is in
> Thread's destructor (std/thread.d line 589/590):
>
> if (state != TS.FINISHED)
>    pthread_detach(id);
>
> The status of an unstarted Thread is TS.INITIAL - I don't know if it
> is necessary to pthread_detach() a thread that hasn't run,
> but if it isn't I'd suggest to change this to
>
> if(state != TS.FINISHED && state != TS.INITIAL)
>    pthread_detach(id);
>
>
Thanks for your bug report. I didn't actually notice you came up with a fix
first time I read your message, but I came to the same conclusion whilst
having a quick 5 minute look at it.

I'll see if a bug is raised upstream, but will include your small resolution
in the next version gdc version.

Thanks Daniel.

Regards

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#581700; Package libphobos-4.1-dev. (Sat, 15 May 2010 20:09:03 GMT) (full text, mbox, link).


Acknowledgement sent to Iain Buclaw <ibuclaw@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sat, 15 May 2010 20:09:03 GMT) (full text, mbox, link).


Message #15 received at 581700@bugs.debian.org (full text, mbox, reply):

From: Iain Buclaw <ibuclaw@ubuntu.com>
To: 581700@bugs.debian.org
Subject: Re: Bug#581700: [libphobos-4.1-dev] Not started Threads cause Segfault on exit
Date: Sat, 15 May 2010 21:07:19 +0100
[Message part 1 (text/plain, inline)]
Upstream bug is http://d.puremagic.com/issues/show_bug.cgi?id=1960


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
[Message part 2 (text/html, inline)]

Reply sent to Sandro Tosi <morph@debian.org>:
You have taken responsibility. (Tue, 13 Jul 2010 18:51:08 GMT) (full text, mbox, link).


Notification sent to Daniel Gibson <metalcaedes@gmail.com>:
Bug acknowledged by developer. (Tue, 13 Jul 2010 18:51:09 GMT) (full text, mbox, link).


Message #20 received at 581700-done@bugs.debian.org (full text, mbox, reply):

From: Sandro Tosi <morph@debian.org>
To: 581700-done@bugs.debian.org, 498960-done@bugs.debian.org, 521622-done@bugs.debian.org, 489138-done@bugs.debian.org, 468775-done@bugs.debian.org, 521582-done@bugs.debian.org, 451707-done@bugs.debian.org, 530005-done@bugs.debian.org, 455407-done@bugs.debian.org
Cc: Sandro Tosi <morph@debian.org>
Subject: gdc-4.1 removed from Debian unstable
Version: 0.25-20080616-4.1.2-27+rm

gdc-4.1 has been removed from Debian unstable: http://bugs.debian.org/577428

Closing its bugs with a Version higher than the last unstable upload.

More information about this script at:
  http://git.debian.org/?p=users/morph/mass-bugs-close.git;a=blob_plain;f=README;hb=HEAD




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 11 Aug 2010 07:31:36 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Tue Dec 17 14:03:10 2024; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.