Subject: bug#27512: 25.2; Crash when working with counsel

From: Eli Zaretskii <[email-masked]>
Date: Wed, 28 Jun 2017 19:07:41 +0300

> From: 仇之东 <[email-masked]>
> Date: Wed, 28 Jun 2017 11:12:09 +0800
> 
> It was reported here firstly, https://github.com/abo-abo/swiper/issues/984
> I cannot repreduce it since it happens occasionally.
> 
> Here are the crash logs:
> Process: Emacs [30324]
> Path: /usr/local/Cellar/emacs/25.2/Emacs.app/Contents/MacOS/Emacs
> Identifier: org.gnu.Emacs
> Version: Version 25.2 (9.0)
> Code Type: X86-64 (Native)
> Parent Process: ??? [1]
> Responsible: Emacs [30324]
> User ID: 501
> 
> Date/Time: 2017-06-27 15:23:54.286 +0800
> OS Version: Mac OS X 10.12.5 (16F73)
> Report Version: 12
> Anonymous UUID: D452D42E-CF25-A6F0-266B-A8E0C3BEE907
> 
> Sleep/Wake UUID: 98E20E1E-8DBC-451F-830A-A2061184FEC7
> 
> Time Awake Since Boot: 650000 seconds
> Time Since Wake: 17000 seconds
> 
> System Integrity Protection: enabled
> 
> Crashed Thread: 0 Dispatch queue: com.apple.main-thread
> 
> Exception Type: EXC_CRASH (SIGABRT)
> Exception Codes: 0x0000000000000000, 0x0000000000000000
> Exception Note: EXC_CORPSE_NOTIFY
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0 libsystem_kernel.dylib 0x00007fffe23c1d42 __pthread_kill + 10
> 1 libsystem_pthread.dylib 0x00007fffe24af457 pthread_kill + 90
> 2 libsystem_c.dylib 0x00007fffe22d8497 raise + 26
> 3 org.gnu.Emacs 0x000000010009a939 terminate_due_to_signal + 138
> 4 org.gnu.Emacs 0x00000001000b19b0 emacs_abort + 19
> 5 org.gnu.Emacs 0x0000000100162050 ns_term_shutdown + 122
> 6 org.gnu.Emacs 0x000000010009aaf4 shut_down_emacs + 262
> 7 org.gnu.Emacs 0x000000010009a904 terminate_due_to_signal + 85
> 8 org.gnu.Emacs 0x00000001000b19b0 emacs_abort + 19
> 9 org.gnu.Emacs 0x00000001000b1aff get_child_status + 173
> 10 org.gnu.Emacs 0x000000010013e6ab handle_child_signal + 70
> 11 org.gnu.Emacs 0x00000001000b29c9 deliver_process_signal + 52

This says that the waitpid function in the following snippet returned
with a value of errno that is not EINTR, in which case Emacs commits
suicide.

  static pid_t
  get_child_status (pid_t child, int *status, int options, bool interruptible)
  {
    pid_t pid;

    /* Invoke waitpid only with a known process ID; do not invoke
       waitpid with a nonpositive argument.  Otherwise, Emacs might
       reap an unwanted process by mistake.  For example, invoking
       waitpid (-1, ...) can mess up glib by reaping glib's subprocesses,
       so that another thread running glib won't find them.  */
    eassert (child > 0);

    while ((pid = waitpid (child, status, options)) < 0)
      {
	/* Check that CHILD is a child process that has not been reaped,
	   and that STATUS and OPTIONS are valid.  Otherwise abort,
	   as continuing after this internal error could cause Emacs to
	   become confused and kill innocent-victim processes.  */
	if (errno != EINTR)
	  emacs_abort ();   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Can you tell what is the value of errno when this happens?  You could
do that by running Emacs under a debugger, setting a breakpoint on the
line marked above, and when the breakpoint breaks the next time,
examine the value of errno and report it.

Thanks.