From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#14569: 24.3.50; bootstrap fails on Cygwin Date: Fri, 14 Jun 2013 10:45:47 -0700 Organization: UCLA Computer Science Department Message-ID: <51BB56CB.7030209__3186.95945102281$1371231975$gmane$org@cs.ucla.edu> References: <51B5DA82.4010703@alice.it> <3EC77598-24B8-42DD-8983-5069E64AAB60@swipnet.se> <51B62175.10307@alice.it> <06F80BBC-D7CD-4E6C-97AD-EB8E476E2FC0@swipnet.se> <83sj0olh38.fsf@gnu.org> <51B7717D.6060702@cs.ucla.edu> <51B77A00.2060908@cornell.edu> <83mwqwl903.fsf@gnu.org> <51B78346.3050600@cornell.edu> <2E06A322-530C-4AA2-9282-6D2E48B1D194@swipnet.se> <51B8BEFE.6070309@cs.ucla.edu> <51B8D5ED.1010407@alice.it> <51BA03CA.4080804@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1371231969 8741 80.91.229.3 (14 Jun 2013 17:46:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Jun 2013 17:46:09 +0000 (UTC) Cc: 14569@debbugs.gnu.org To: cygwin@cygwin.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 14 19:46:10 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1UnY4f-0003yy-Rz for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Jun 2013 19:46:10 +0200 Original-Received: from localhost ([::1]:60576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnY4f-0002jx-EC for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Jun 2013 13:46:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnY4a-0002im-C4 for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2013 13:46:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnY4Y-0008AL-S7 for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2013 13:46:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnY4Y-0008AC-Mh for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2013 13:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UnY4X-0007rJ-P2 for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2013 13:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jun 2013 17:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14569 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14569-submit@debbugs.gnu.org id=B14569.137123195830198 (code B ref 14569); Fri, 14 Jun 2013 17:46:01 +0000 Original-Received: (at 14569) by debbugs.gnu.org; 14 Jun 2013 17:45:58 +0000 Original-Received: from localhost ([127.0.0.1]:44459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UnY4T-0007qz-LP for submit@debbugs.gnu.org; Fri, 14 Jun 2013 13:45:58 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:47907) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UnY4R-0007qe-Tq for 14569@debbugs.gnu.org; Fri, 14 Jun 2013 13:45:56 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id A6696A60002; Fri, 14 Jun 2013 10:45:49 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xsy-8TC+uSLJ; Fri, 14 Jun 2013 10:45:48 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-71-108-49-126.lsanca.fios.verizon.net [71.108.49.126]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 373BE39E8008; Fri, 14 Jun 2013 10:45:48 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 In-Reply-To: X-Enigmail-Version: 1.5.1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75120 Archived-At: Cygwin developers, I'm worried about a Cygwin bug where pthread_kill may not send a signal to the correct thread. This bug may be causing Emacs to crash. The Cygwin bug is discussed in this thread: http://cygwin.com/ml/cygwin/2012-05/msg00472.html Emacs uses pthread_kill to redirect SIGCHLD to the main thread; if this is sent to a random thread instead, that could explain the random crashes. My question is: does this bug still exist with Cygwin, and if so is it likely to get fixed soon? More details about the Emacs bug can be found here: http://bugs.gnu.org/14569 Briefly, Emacs is crashing randomly on Cygwin ever since it started doing this: /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself; this should always fail, but is enough to initialize glib's private SIGCHLD handler. */ g_source_unref (g_child_watch_source_new (getpid ())); After this newly-inserted code, Emacs finds out what the child signal handler was: /* Now, find out what glib's signal handler was, and store it into lib_child_handler. */ struct sigaction action, old_action; emacs_sigaction_init (&action, deliver_child_signal); sigaction (SIGCHLD, &action, &old_action); eassert (! (old_action.sa_flags & SA_SIGINFO)); if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN && old_action.sa_handler != deliver_child_signal) lib_child_handler = old_action.sa_handler; Emacs's SIGCHILD handler, deliver_child_signal, arranges the signal handling to occur in the main thread (to avoid races within Emacs), like this: int old_errno = errno; bool on_main_thread = true; if (! pthread_equal (pthread_self (), main_thread)) { sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, sig); pthread_sigmask (SIG_BLOCK, &blocked, 0); pthread_kill (main_thread, sig); on_main_thread = false; } if (on_main_thread) handle_child_signal (sig); errno = old_errno; And handle_child_signal, which runs in the main thread, does a bunch of Emacsish things and then invokes lib_child_handler (sig), which is glib's SIGCHLD handler. All this works just fine on Fedora and other platforms; but it doesn't work on Cygwin.