Subject: bug#28268: 26.0.50; (MS Windows) crash on C-g after closing Git GUI

From: Richard Copley <[email-masked]>
Date: Mon, 28 Aug 2017 22:10:56 +0100

Emacs sometimes crashes when I type C-g just after closing a process.
I've only seen this happen after the following recipe using Magit on MS
Windows. (Not sure whether or not Magit is essential.)

Recipe:

Visit a git repo.
C-x g ; magit-status
! g   ; magit-run-popup, magit-run-git-gui
;; A nasty-looking window pops up (Git GUI, I presume). Close it.
C-g   ; Crashes.

The crash is a SIGTRAP and the stack trace of the faulting thread is
as follows:

#0  0x000007fefcb831f3 in KERNELBASE!DebugBreak ()
   from C:\Windows\system32\KernelBase.dll
No symbol table info available.
#1  0x0000000400244966 in emacs_abort () at w32fns.c:10931
        button = 6
#2  0x00000004001a74ce in signal_or_quit (error_symbol=..., data=...,
    keyboard_quit=true) at eval.c:1535
        conditions = {i = 8565584}
        string = {i = 51800}
        real_error_symbol = {i = 51800}
        clause = {i = 0}
        h = 0x0
#3  0x00000004001a7448 in quit () at eval.c:1513
No locals.
#4  0x00000004001a7379 in process_quit_flag () at eval.c:1460
        flag = {i = 60032}
#5  0x00000004001a73ce in maybe_quit () at eval.c:1483
No locals.
#6  0x000000040027d085 in waitpid (pid=10708, status=0x0, options=1)
    at w32proc.c:1452
        active = 0
        retval = 8566456
        nh = 1
        cp = 0x401bca5a0 <child_procs+288>
        cps = {0x401bca5a0 <child_procs+288>, 0xffffffffffffffff, 0x0, 0x1c,
          0x82b598, 0xffffffffffffffff, 0x4, 0x82b5f0, 0x7,
          0xffffffffffffd8f0, 0x48, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
          0x0, 0x15c, 0x158, 0x1e0, 0x284, 0x258, 0x294, 0x3c, 0x0, 0x1, 0x0,
          0x1, 0x76d316e3 <WaitForMultipleObjectsEx+179>}
        wait_hnd = {0x258, 0x0, 0xebb7230, 0x100000001, 0x82b4a0,
          0x40010f048 <unblock_input+24>, 0x0, 0x1, 0x0, 0x0, 0x82b530,
          0x40025b3d4 <w32_read_socket+9323>, 0x82b5d0, 0x0, 0x0, 0x0, 0x0,
          0x0, 0x0, 0x100000000, 0x1c, 0x1c, 0xffffffff, 0x1, 0x1,
          0x600000006, 0x6, 0x0, 0x0, 0x1b, 0x1600000000,
          0x7fefcb51430 <KERNELBASE!GetCurrentProcess+64>}
        timeout_ms = 0
        dont_wait = 1
#7  0x0000000400122068 in get_child_status (child=10708, status=0x0,
    options=1, interruptible=false) at sysdep.c:397
        pid = 0
#8  0x0000000400122157 in child_status_changed (child=10708, status=0x0,
    options=0) at sysdep.c:443
No locals.
#9  0x000000040020a229 in handle_child_signal (sig=18) at process.c:7049
        deleted_pid = 10708
        all_pids_are_fixnums = false
        head = {i = 164145587}
        xpid = {i = 42834}
        tail = {i = 164145571}
        proc = {i = 0}
#10 0x0000000400122f97 in deliver_process_signal (sig=18,
    handler=0x40020a16d <handle_child_signal>) at sysdep.c:1659
        old_errno = 22
        on_main_thread = true
#11 0x000000040020a400 in deliver_child_signal (sig=18) at process.c:7098
No locals.
#12 0x000000040027ecc8 in sys_select (nfds=7, rfds=0x82c108, wfds=0x82c100,
    efds=0x0, timeout=0x82c0e0, ignored=0x0) at w32proc.c:2403
        orfds = {bits = {81, 0}}
        owfds = {bits = {0, 0}}
        timeout_ms = 1
        start_time = 979426646
        i = 7
        nh = 4
        nc = 2
        nr = 0
        active = 4
        cp = 0x401bca5a0 <child_procs+288>
        cps = {0x401bca5a0 <child_procs+288>, 0x401bca510 <child_procs+144>,
          0x82bd60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x82bca0,
          0x4000f98ef <builtin_lisp_symbol+49>, 0x4006a5ee0 <lispsym>, 0x0,
          0x82bcc0, 0x4000f9bb9 <XSETCDR+25>, 0x846cdf3,
          0x4000fb21b <CHECK_LIST_END+36>, 0x0, 0x846cdf3, 0x82bd00,
          0x4000f9f14 <ASIZE+21>, 0x59a482e4, 0x1b4d6cf8, 0x82bd70,
          0x400196f4a <lisp_to_timespec+155>, 0x82bd90, 0x59a482e4,
          0x1b4d6cf8, 0x6fd4b, 0x0, 0x40022f219 <sys_mutex_unlock+25>, 0x0,
          0x82be80}
        wait_hnd = {0x15c, 0x158, 0x1e0, 0x284, 0x258, 0x294,
          0x0 <repeats 72 times>, 0x8, 0x7fefcb518da <ResetEvent+10>, 0x0,
          0x40025f912 <drain_message_queue+107>, 0x0, 0x82bc30, 0x0,
          0x40025f704 <get_next_msg+630>, 0x0, 0x0, 0x0, 0x0, 0x82bc30,
          0x40010f048 <unblock_input+24>, 0x0, 0x0, 0x0, 0x0}
        fdindex = {-1, 0, 4, 6, 0 <repeats 60 times>}
#13 0x000000040022e45e in really_call_select (arg=0x82bf40) at thread.c:566
        sa = 0x82bf40
        self = 0x4006b9a60 <main_thread>
        oldset = 4294967295
#14 0x00000004001829da in flush_stack_call_func (
    func=0x40022e3cc <really_call_select>, arg=0x82bf40) at alloc.c:5158
        end = 0x82be00
        self = 0x4006b9a60 <main_thread>
        sentry = {o = {__max_align_ll = 1503953635,
            __max_align_ld = <invalid float value>}}
#15 0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

In GNU Emacs 26.0.50 (build 1, x86_64-w64-mingw32)
 of 2017-08-22 built on 60678UHB
Repository revision: 036a92eb006cc175d13ad7ada80225eb8340724d
Windowing system distributor 'Microsoft Corp.', version 6.1.7601
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
<nil> <wheel-down> is undefined
<nil> <double-wheel-down> is undefined
<nil> <triple-wheel-down> is undefined

Configured using:
 'configure --prefix=/mingw64 --config-cache --with-modules
 --without-pop CFLAGS=-O2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote w32notify w32 multi-tty make-network-process emacs)

Memory information:
((conses 16 98353 8762)
 (symbols 56 20130 1)
 (miscs 48 40 107)
 (strings 32 30128 1430)
 (string-bytes 1 780999)
 (vectors 16 14782)
 (vector-slots 8 489133 4992)
 (floats 8 53 142)
 (intervals 56 235 0)
 (buffers 992 12))