From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Evans Newsgroups: gmane.comp.gdb.patches,gmane.lisp.guile.devel Subject: Re: [PATCH][PR guile/17247] Block SIGCHLD while initializing Guile Date: Mon, 1 Sep 2014 09:34:55 -0700 Message-ID: References: <834mwsh2nu.fsf@gnu.org> <20140901124840.GA32201@blade.nx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1409589319 7489 80.91.229.3 (1 Sep 2014 16:35:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2014 16:35:19 +0000 (UTC) Cc: Eli Zaretskii , "gdb-patches@sourceware.org" , guile-devel To: Gary Benson Original-X-From: gdb-patches-return-115434-gdb-gdb-patches=m.gmane.org@sourceware.org Mon Sep 01 18:35:13 2014 Return-path: Envelope-to: gdb-gdb-patches@plane.gmane.org Original-Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XOUZT-0004TZ-KA for gdb-gdb-patches@plane.gmane.org; Mon, 01 Sep 2014 18:35:11 +0200 DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; q=dns; s=default; b= yIdQ0AiUlj7JtlJF2AlRk1Yqzq0VnJNGFNfmnX6B/JVAJ3jLeCdaC/MHJ+949bBV dMbaZ0jWCxqqpJuQhU8u8pC3yevmo8+61OGLwb9+n+X0Ip19DXZeX5EBzQcg2P6r e8D8F7MBmovN7vC6ZxEQxxHRK9xKAuePfiF4bIf35Eg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; s=default; bh=jYu+o HCBhHaZEoQrUuH5YpLwsAA=; b=lspxEGq51r4A3+7dCrGIcCUeJIrS/5uLTW/84 GZ4jIaTF4fjUbEgAgpGaoa6HB8h94bicBIs9+aexseesMvfexZCStf49V+J6n6v3 u0T3kZKHbr40s2vsis0ljy/D79QNwgrg4OI94J6L7lkHYKY8hxqsDYB7kZiFjQyr JoAlig= Original-Received: (qmail 8669 invoked by alias); 1 Sep 2014 16:35:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: gdb-patches-owner@sourceware.org Original-Received: (qmail 8650 invoked by uid 89); 1 Sep 2014 16:35:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yh0-f47.google.com Original-Received: from mail-yh0-f47.google.com (HELO mail-yh0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 01 Sep 2014 16:34:57 +0000 Original-Received: by mail-yh0-f47.google.com with SMTP id c41so3518138yho.20 for ; Mon, 01 Sep 2014 09:34:55 -0700 (PDT) X-Received: by 10.236.162.7 with SMTP id x7mr42913677yhk.6.1409589295244; Mon, 01 Sep 2014 09:34:55 -0700 (PDT) Original-Received: by 10.170.66.138 with HTTP; Mon, 1 Sep 2014 09:34:55 -0700 (PDT) In-Reply-To: <20140901124840.GA32201@blade.nx> X-IsSubscribed: yes Xref: news.gmane.org gmane.comp.gdb.patches:100415 gmane.lisp.guile.devel:17386 Archived-At: On Mon, Sep 1, 2014 at 5:48 AM, Gary Benson wrote: > Doug Evans wrote: >> On Sun, Aug 31, 2014 at 12:36 PM, Eli Zaretskii wrote: >> > > From: Doug Evans >> > > Date: Sun, 31 Aug 2014 12:07:58 -0700 >> > > >> > > Basically, current Guile (git) starts an internal thread (the >> > > "finalizer" thread), and libgc as of 7.4 now starts several >> > > marker threads by default (before 7.4.0 one needed to configure >> > > libgc with --enable-parallel-mark). >> > > >> > > When other threads are running, and they haven't blocked >> > > SIGCHLD, then the kernel may send SIGCHLD to these threads, >> > > leaving gdb hung in the sigsuspend calls in linux-nat.c. >> > >> > A heretic thought: is it at all a good idea to have Guile (and GC) >> > start threads when they run under GDB? GDB is a single-threaded >> > program, so having it linked against libraries that start threads >> > whenever they like is IME a source of subtle problems (like this >> > one) and a lot of pain down the road. Anything GDB does that >> > affects the global environment of the whole program (e.g., I/O >> > redirection) will also affect those threads, with who knows what >> > consequences. >> > >> > So maybe The Right Way of fixing these problems is configure Guile >> > and GC so that they never start any additional threads? >> >> Users are going to want to start threads. >> I've seen that already. >> I think we should not shy away from them. > > This patch ensures the internal threads are created with SIGCHLD > blocked. Does something do this for other (user started?) threads? What to do for user-started threads is an open question, both for Python and Guile. For reference sake, see PR 17314. [Still working on a testcase. What I added to the PR is just a snippet to get thoughts down.]