From owner-freebsd-threads@FreeBSD.ORG Thu Aug 10 12:47:11 2006 Return-Path: X-Original-To: threads@freebsd.org Delivered-To: freebsd-threads@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D42F416A4DD; Thu, 10 Aug 2006 12:47:11 +0000 (UTC) (envelope-from simonmar@microsoft.com) Received: from mail-eur.microsoft.com (mail-eur.microsoft.com [213.199.128.145]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3875C43D45; Thu, 10 Aug 2006 12:47:11 +0000 (GMT) (envelope-from simonmar@microsoft.com) Received: from EUR-MSG-20.europe.corp.microsoft.com ([65.53.210.18]) by mail-eur.microsoft.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 10 Aug 2006 13:47:07 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Aug 2006 13:47:06 +0100 Message-ID: <2E9B33CE230409489A7ED37E5E34090F05148C80@EUR-MSG-20.europe.corp.microsoft.com> in-reply-to: <20060807182923.F45647@fledge.watson.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: GHC 6.4.3 on FreeBSD (fwd) thread-index: Aca6R0tTIvzngMy0SPSsiRlMH1N3BwCMrJIw From: "Simon Marlow" To: "Robert Watson" X-OriginalArrivalTime: 10 Aug 2006 12:47:07.0457 (UTC) FILETIME=[16B49310:01C6BC7B] Cc: glasgow-haskell-users@haskell.org, haskell@freebsd.org, Volker Stolz , Simon Peyton-Jones , Tony Finch , threads@freebsd.org Subject: RE: GHC 6.4.3 on FreeBSD (fwd) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2006 12:47:12 -0000 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 > To: Robert Watson > 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.