From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Evans Newsgroups: gmane.lisp.guile.devel Subject: Re: Need to block SIGCHLD in libgc and guile internal threads Date: Tue, 26 Aug 2014 09:41:10 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1409071314 21626 80.91.229.3 (26 Aug 2014 16:41:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Aug 2014 16:41:54 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Aug 26 18:41:48 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XMJoY-0001HR-GK for guile-devel@m.gmane.org; Tue, 26 Aug 2014 18:41:46 +0200 Original-Received: from localhost ([::1]:54605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMJoY-0008Ln-5G for guile-devel@m.gmane.org; Tue, 26 Aug 2014 12:41:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMJo0-0007kB-7k for guile-devel@gnu.org; Tue, 26 Aug 2014 12:41:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMJny-0003FY-OX for guile-devel@gnu.org; Tue, 26 Aug 2014 12:41:12 -0400 Original-Received: from mail-yh0-x229.google.com ([2607:f8b0:4002:c01::229]:63019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMJny-0003FR-Kh for guile-devel@gnu.org; Tue, 26 Aug 2014 12:41:10 -0400 Original-Received: by mail-yh0-f41.google.com with SMTP id b6so12171834yha.14 for ; Tue, 26 Aug 2014 09:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=03RRJd9KW+1C0EgyAbrSbReL0/KUhUdpzYLjkOIF2oU=; b=MY4cf5MUfPhyVmFpDH7tGUVgs4M6u8JDHPos7si6p5P73koVHhfeXzcUUR9cF232z9 EF3MeoCK+0R4xYCb2W/vBoJCaJbyR54n66LoXIWcBuKE66o28g37RAgXAG0dtVx3sEFb ACkh2YD/EOt42gDWul/e8UxsjPxADlqMxrVR7doIzLNwyVq5wPR9N5iOEKHqVl9AEa9l VrYf1nid2T7tk4FFjM5tpRKPlN4KGTjmHc8pOf+x/dx3uAWjYVMqueSUlIo8erZus41/ 8hBpgthivEFJpHwEh/NfXrIaEzQ34OX9HE7W8XVeLqDYU5LHXcUWOOShZGml47Otn79W FY3A== X-Received: by 10.236.45.10 with SMTP id o10mr43424128yhb.49.1409071270128; Tue, 26 Aug 2014 09:41:10 -0700 (PDT) Original-Received: by 10.170.66.138 with HTTP; Tue, 26 Aug 2014 09:41:10 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c01::229 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17371 Archived-At: On Tue, Aug 26, 2014 at 1:14 AM, Doug Evans wrote: > Hi. > > I think(!) I understand why gdb is hanging when used with libgc 7.4.x. > This is gdb bug 17247. > https://sourceware.org/bugzilla/show_bug.cgi?id=17247#c30 > > First, libgc 7.4.x was the first release to default PARALLEL_MARK to > on, so I'm guessing the same "bug" exists in 7.2, it's just not > visible unless one builds libgc with --enable-parallel-mark. > > gdb/linux-nat.c calls sigsuspend when the inferior is running and gdb > needs to wait for it to stop. > gdb is waiting on a SIGCHLD at this point. > > However, if the SIGCHLD goes to a different thread, say the guile > finalizer thread or a libgc marker thread then the sigsuspend that gdb > calls doesn't wake up and gdb is hung. > > So question: Any suggestions for how to approach this? Since threads inherit the sigmask of their creator one thing I could do, I think, is block SIGCHLD before initializing Guile and then unblock it afterwards. The four threads I see being created during Guile initialization (3 marker threads plus Guile's finalizer thread) are created during that time. Question: Does Guile create any threads lazily? [I'm referring to internal Guile-created threads. Users who create their own threads are on their own, at least for now. IWBN though if there were a mechanism to have all threads that Guile created have SIGCHLD initially blocked. I wouildn't make it SIGCHLD-specific of course - just have a way to augment the initial sigmask of newly created threads.]