Subject: 27.0.60; Intermittent crash on MacOS 10.14 in setup_process_coding_systems

From: Justin Guenther <[email-masked]>
Date: Fri, 17 Jan 2020 13:00:47 -0600

I've been seeing an intermittent crash in setup_process_coding_systems
(crash traces are attached). It seems to most frequently happen from
create_process -> setup_process_coding_systems, but that may just be
due to my frequent usage of `helm-do-ag-project-root'.

For the attached crash_2020-01-15_1_create_process.log, it happened
when using `helm-do-ag-project-root', which takes input from the
minibuffer and runs an external `ag` (the_silver_searcher) process to
search the current project (in this case, a git repo) and
display/refresh the results as I type in the minibuffer.

For the other crash logs, unfortunately I didn't record what I was
doing at the time. But IIRC most of them were from
`helm-do-ag-project-root`.

I have also seen this crash happen in other packages: `magit`, when
opening a magit-status buffer (which runs various git commands, e.g.
`git status`); and when starting up an external language server
process from `lsp-go` (although I've most frequently seen this from
helm).

I've also had at least one crash in `setup_process_coding_systems'
that was called by `connect_network_socket' (see
crash_2020-01-06_2.log attached). I believe this crash happened when I
opened a `go-mode' buffer and `lsp-mode' was starting up an external
language server process, but I'm not 100% sure of that.

Unfortunately it's a similar situation to bug#38822--I started seeing
this at some point after recompiling emacs from source, somewhere
approx. between cbc10ec71e9f189e8d6fd5c6927aec4872e0fd96 and
0bc00cda3cb6e765b0e1f0105edf75425bce13c9 (which is a long range of
commits unfortunately).

I've also recompiled from source from the emacs-27 branch a few times
since then, but it doesn't seem to have affected how often I get this
crash (my most recent build was @
16eaaa07e6ba6a41ccdc562dcb52fc87c38f8083, with a small patch applied
from https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38748#92 to try
fixing a seemingly-unrelated crash to this one--see bug#38822).

I haven't managed to reproduce this from 'emacs -Q' yet, and also
haven't caught it in a debugger unfortunately.

The crash seems to happen somewhat reliably when I open a couple file
buffers from one project, then open a new frame -> another buffer in
another large project that has lots of files (which happens to also
use `go-mode' and `lsp-mode'), and try running
`helm-do-ag-project-root' while point is inside a symbol (which causes
helm to pass a default to the minibuffer). I usually get a crash at
this point.

Sorry, I know that's not a lot of help (and unfortunately I can't
share the contents of either of those projects that's triggering
this). I'll try to get better reproduction steps and/or get a debugger
backtrace if possible.

---

In GNU Emacs 27.0.60 (build 1, x86_64-apple-darwin18.7.0, NS
appkit-1671.60 Version 10.14.6 (Build 18G2022))
 of 2020-01-10 built on jguenther-mbp
Repository revision: ff8996a337377731905a7a3c9bf05e2281df40ef [NB:
this is 16eaaa07e6ba6a41ccdc562dcb52fc87c38f8083 with the above patch
applied]
Repository branch: emacs-27
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.6

Configured using:
 'configure --disable-silent-rules
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/27.0.60/share/info/emacs
 --prefix=/usr/local/Cellar/emacs/27.0.60 --with-gnutls --without-x
 --with-xml2 --with-dbus --with-imagemagick --with-modules --with-rsvg
 --with-json --with-ns --disable-ns-self-contained 'CFLAGS=-Os -w -pipe
 -march=nehalem -Xclang -target-feature -Xclang -aes
 -mmacosx-version-min=10.14 -isysroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk'
 'CPPFLAGS=-I/usr/local/opt/icu4c/include
 -I/usr/local/opt/sqlite/include -I/usr/local/opt/readline/include
 -I/usr/local/opt/imagemagick@6/include
 -I/usr/local/opt/[email-masked]/include -I/usr/local/opt/gettext/include
 -F/usr/local/Frameworks -isysroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk'
 'LDFLAGS=-L/usr/local/opt/icu4c/lib -L/usr/local/opt/sqlite/lib
 -L/usr/local/opt/readline/lib -L/usr/local/opt/imagemagick@6/lib
 -L/usr/local/opt/[email-masked]/lib -L/usr/local/opt/libffi/lib
 -L/usr/local/opt/gettext/lib -L/usr/local/lib -F/usr/local/Frameworks
 -Wl,-headerpad_max_install_names -isysroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk''

Configured features:
RSVG IMAGEMAGICK DBUS GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $EMACSDATA: /usr/local/opt/emacs/share/emacs/27.0.60/etc
  value of $EMACSDOC: /usr/local/opt/emacs/share/emacs/27.0.60/etc/
  value of $EMACSLOADPATH:
:/usr/local/opt/emacs/share/emacs/site-lisp:/usr/local/share/emacs/site-lisp/cask:/usr/local/opt/emacs/share/emacs/27.0.60/lisp:/usr/local/opt/emacs/share/emacs/27.0.60/site-lisp
  value of $EMACSPATH:
/usr/local/opt/emacs/libexec/emacs/27.0.60/x86_64-apple-darwin18.7.0
  value of $LC_ALL: en_CA.UTF-8
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8

<snip>