From owner-freebsd-perl@FreeBSD.ORG Wed Mar 10 01:00:01 2010 Return-Path: Delivered-To: freebsd-perl@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06EF7106566B for ; Wed, 10 Mar 2010 01:00:00 +0000 (UTC) (envelope-from djmitche@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id 88E618FC19 for ; Wed, 10 Mar 2010 01:00:00 +0000 (UTC) Received: by bwz8 with SMTP id 8so3829725bwz.3 for ; Tue, 09 Mar 2010 16:59:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=ZkLL8qw6Uiq9vEB77zCMvu3ut6VwP01BxLJ1I1NYjRE=; b=Nrt86QClvPD5T/QDESBJLPAHXawPjCNJ9JQ20tMldDXOBhdZ/9SZa0Tu05RP0EbXmv Qq1/2YtY957JN2tPRxaR6M5hDb3Yv32Nd5NmPpgxJHIyKeyIENCiY8+8+frHpKLAFESc dy0ZtPCGrYNeePUNNZKkwZ3VFg4SyNB4kG8lQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=d6tDEUC80dWV81FkYHxxrfZ5k9frBUWvQCxivKryo7SqHCh3WbFH9BIZkGpy8d+WJY Xpv3Ign4etNzWMiJ49hF2bRjNDtePetv2mbdcHhpiT+srs/Gh63EHCq+WMxhP6zIiGen KOiaJiTV4o6NQ2X8hlDiimkkOph6XTz1hUvmk= MIME-Version: 1.0 Sender: djmitche@gmail.com Received: by 10.204.130.90 with SMTP id r26mr792302bks.9.1268181158290; Tue, 09 Mar 2010 16:32:38 -0800 (PST) Date: Tue, 9 Mar 2010 18:32:38 -0600 X-Google-Sender-Auth: 007a8764353fa4c4 Message-ID: <42338fbf1003091632j1fb96efdrfa0f00d2edf0a9d1@mail.gmail.com> From: "Dustin J. Mitchell" To: freebsd-perl@freebsd.org Content-Type: text/plain; charset=UTF-8 Subject: Unthreaded Perl linked to threaded libraries X-BeenThere: freebsd-perl@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: maintainer of a number of perl-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2010 01:00:01 -0000 I'm running into a problem with Amanda (http://amanda.org) on FreeBSD, and looking for some guidance. Before anyone sends me to amanda-users: I'm one of the Amanda developers, so the guidance I need is related to FreeBSD and its threading. Amanda is currently being rewritten from C into Perl, with the interface handled by SWIG. The Perl code is all single-threaded, but the underlying C code uses threads internally, via glib's libgthread. Basically, Perl runs in the main thread and calls the shots, while the C code gets the job done in threads. The idea is that, because no part of Perl's state is ever accessed in a thread but the main thread, this won't pose a problem. What I'm seeing on FreeBSD 7.0 is that programs with threads but no perl work fine, and perl programs that call into C libraries work fine, but perl programs that call C libraries that start a thread hang in the g_thread_create call. A truss looks like this: 4886 perl5.8.9 CALL _umtx_op(0xffffd6dc,0x3,0x1,0,0) 4886 perl5.8.9 RET _umtx_op 0 4886 perl5.8.9 CALL sigprocmask(SIG_BLOCK,0xffffd670,0x2832a0d8) 4886 perl5.8.9 RET sigprocmask 0 4886 perl5.8.9 CALL sigprocmask(SIG_SETMASK,0x2832a0d8,0) 4886 perl5.8.9 RET sigprocmask 0 4886 perl5.8.9 CALL sigprocmask(SIG_BLOCK,0xffffd5c0,0x2832a0d8) 4886 perl5.8.9 RET sigprocmask 0 4886 perl5.8.9 CALL sigprocmask(SIG_SETMASK,0x2832a0d8,0) 4886 perl5.8.9 RET sigprocmask 0 4886 perl5.8.9 CALL _umtx_op(0x2877bce0,0x11,0,0,0) that CALL never returns. I'm not really sure where to start figuring this out. The best I can think of is to read the source for the _umtx_op syscall. Does anyone have any better pointers? Dustin -- Open Source Storage Engineer http://www.zmanda.com