This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: bug#14569: 24.3.50; bootstrap fails on Cygwin
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: cygwin at cygwin dot com
- Cc: 14569 at debbugs dot gnu dot org
- Date: Fri, 14 Jun 2013 10:45:47 -0700
- Subject: Re: bug#14569: 24.3.50; bootstrap fails on Cygwin
- References: <b4m61xqu654 dot fsf at jpl dot org> <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> <FA9D25B7-3D1F-40CC-AA6E-5347E8112CA4 at swipnet dot se> <E143AC75-8C2B-4A59-81F6-571B9D4EEF13 at swipnet dot se> <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> <C679A2B2-0264-4DDA-B900-5B90BE7CF1E9 at swipnet dot se> <51BA03CA dot 4080804 at cs dot ucla dot edu> <BEC82502-E9FD-4F8E-B91E-F680F6885FB2 at swipnet dot se>
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