X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=mWdDzhi3buJ8xS2Q y0LQ5+N/E3zvwD4Sp/Kmvp/KhaWNvpCxP2aIfS3NVZHLt8IJ41fOkdNJKxCE8/rn Sj/pogB3S+5h7s9g0XuHAdCrLsax6F8gknY709Yc/HDxII7cqg2BraLkRrfAeBpW jDY/aQ4LyKPt6hkZsg5LPTdnOOw= 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:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=X/NyblFybl4347lzzyiyUN M0z+4=; b=d6Pv5FGr+MW75ent0y/ybVDaJzcFeduuPG2a55XckKpLkIcY2CDArO O9YSq01jZrGAnipUtuQpVuHAx3KX/mr2Y4+vEfzVM0lvb5NXhpAU4QxpZNrpslnR z6eJPrMQWbYmfURV+7b4mvOa6lLfyBtIwbT0Mr1FESKTBQXdfV8Z8= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Spam-SWARE-Status: No, score=-6.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Message-ID: <51BB56CB.7030209@cs.ucla.edu> Date: Fri, 14 Jun 2013 10:45:47 -0700 From: Paul Eggert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: cygwin AT cygwin DOT com CC: 14569 AT debbugs DOT gnu DOT org Subject: Re: bug#14569: 24.3.50; bootstrap fails on Cygwin References: <51B5DA82 DOT 4010703 AT alice DOT it> <3EC77598-24B8-42DD-8983-5069E64AAB60 AT swipnet DOT se> <51B62175 DOT 10307 AT alice DOT it> <06F80BBC-D7CD-4E6C-97AD-EB8E476E2FC0 AT swipnet DOT se> <83sj0olh38 DOT fsf AT gnu DOT org> <51B7717D DOT 6060702 AT cs DOT ucla DOT edu> <51B77A00 DOT 2060908 AT cornell DOT edu> <83mwqwl903 DOT fsf AT gnu DOT org> <51B78346 DOT 3050600 AT cornell DOT edu> <2E06A322-530C-4AA2-9282-6D2E48B1D194 AT swipnet DOT se> <51B8BEFE DOT 6070309 AT cs DOT ucla DOT edu> <51B8D5ED DOT 1010407 AT alice DOT it> <51BA03CA DOT 4080804 AT cs DOT ucla DOT edu> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple