GHC 6.4.3 on FreeBSD (fwd)

Simon Marlow simonmar at microsoft.com
Thu Aug 10 08:47:06 EDT 2006


Dear threads at 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=0x29091758, workingDirectory=0x0,
environment=0x0, 
    fdStdInput=0, fdStdOutput=1, fdStdError=2, set_inthandler=1,
inthandler=0, 
    set_quithandler=1, quithandler=0) 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,
> 
> 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.
> 
> Thanks,
> 
> Robert N M Watson
> Computer Laboratory
> University of Cambridge
> 
> ---------- Forwarded message ----------
> Date: Mon, 7 Aug 2006 13:15:21 -0400 (EDT)
> From: Daniel Eischen <deischen at freebsd.org>
> To: Robert Watson <rwatson at freebsd.org>
> Cc: threads at freebsd.org
> Subject: Re: GHC 6.4.3 on FreeBSD (fwd)
> 
> On Mon, 7 Aug 2006, Robert Watson wrote:
> 
>> 
>> 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.
> 
> Try this patch.



More information about the Glasgow-haskell-users mailing list