Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 2006 13:47:06 +0100
From:      "Simon Marlow" <simonmar@microsoft.com>
To:        "Robert Watson" <rwatson@FreeBSD.org>
Cc:        glasgow-haskell-users@haskell.org, haskell@freebsd.org, Volker Stolz <vs@foldr.org>, Simon Peyton-Jones <simonpj@microsoft.com>, Tony Finch <dot@dotat.at>, threads@freebsd.org
Subject:   RE: GHC 6.4.3 on FreeBSD (fwd)
Message-ID:  <2E9B33CE230409489A7ED37E5E34090F05148C80@EUR-MSG-20.europe.corp.microsoft.com>
In-Reply-To: <20060807182923.F45647@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Dear threads@freebsd.org (and others),

This is relating to the problems we're experiencing with GHC's threaded
runtime on FreeBSD (see context below).

GHC itself, which is a Haskell program, when compiled with itself and
linked against GHC's threaded runtime, sometimes hangs eating 100% CPU.
This happens when it is linked with -pthreads, I haven't seen it when
linking with -lthr.

If I attach using gdb to a hung process, I see this:

(gdb) where
#0  0x2897146b in pthread_testcancel () from /usr/lib/libpthread.so.2
#1  0x28972499 in __error () from /usr/lib/libpthread.so.2
#2  0x2895e6ba in sigaction () from /usr/lib/libpthread.so.2
#3  0x087ea6b4 in runProcess (args=3D0x29091758, workingDirectory=3D0x0,
environment=3D0x0,=20
    fdStdInput=3D0, fdStdOutput=3D1, fdStdError=3D2, set_inthandler=3D1,
inthandler=3D0,=20
    set_quithandler=3D1, quithandler=3D0) at runProcess.c:61
#4  0x0879b3d0 in s3ja_info ()

Now, runProcess() is part of our libraries.  It is basically doing a
fork/exec combo, with some sigaction()s and other stuff in between.  As
I understand the POSIX spec, it should be safe to do sigaction() in the
child of a fork() in a multithreaded process.  So I'm surprised to see
pthread_testcancel on the stack there.

This is about all I've managed to extract.  gdb is having difficulty
looking at the other threads:

(gdb) info thr
* 5 LWP 100331  0x2897146b in pthread_testcancel () from
/usr/lib/libpthread.so.2
  4 Thread 0x8920000 (LWP 100278)  Cannot get lwp 100278 registers:
Operation not permitted

for unknown reasons.

Any help would be appreciated...

Cheers,
	Simon

On 07 August 2006 18:31, Robert Watson wrote:

> Dear many,
>=20
> I pinged the FreeBSD threads list about the previously mentioned
> problem, and was sent this patch by Dan Eischen.  The FreeBSD threads
> mailing list is extremely responsive to bug reports; my
> recommendation is that we direct future specific bug reports, as well
> as any feedback on this patch, to that list.
>=20
> Thanks,
>=20
> Robert N M Watson
> Computer Laboratory
> University of Cambridge
>=20
> ---------- Forwarded message ----------
> Date: Mon, 7 Aug 2006 13:15:21 -0400 (EDT)
> From: Daniel Eischen <deischen@freebsd.org>
> To: Robert Watson <rwatson@freebsd.org>
> Cc: threads@freebsd.org
> Subject: Re: GHC 6.4.3 on FreeBSD (fwd)
>=20
> On Mon, 7 Aug 2006, Robert Watson wrote:
>=20
>>=20
>> I've been talking to the Haskell folk about problems they've had
>> getting their threaded runtime running on FreeBSD.  Here's one of
>> their problem reports. Since I'm not up on how threads and signals
>> are supposed to act, I can't confirm the below is a bug, of course,
>> but figured you (experts) would be able to respond better.
>=20
> Try this patch.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2E9B33CE230409489A7ED37E5E34090F05148C80>