Subject: 29.0.50; crash in GC

From: Sam Steingold <[email-masked]>
Date: Mon, 12 Sep 2022 10:37:17 -0400

About a week ago Emacs crashed and now it consistently crashes on
startup if I agree to load the desktop file from the crashed session.
If I refuse to load the desktop file and instead load files on-by-one, I
also eventually (an hour or a day later) get a crash, albeit I do get
some work done in the meantime.
I did a few `git pull && make bootstrap` (the latest this morning) in
the vain (so far) hope that the problem disappears.

Here is the backtrace:

--8<---------------cut here---------------start------------->8---
(lldb) run
Process 73681 launched: '/Users/sdsg/src/emacs/build/src/emacs' (x86_64)
2022-09-12 10:08:57.646156-0400 emacs[73681:5354078] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=73681
2022-09-12 10:08:57.646250-0400 emacs[73681:5354078] SecTaskCopyDebugDescription: emacs[73681]/0#-1 LF=0
2022-09-12 10:08:58.324343-0400 emacs[73681:5354078] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=73681
2022-09-12 10:08:58.324465-0400 emacs[73681:5354078] SecTaskCopyDebugDescription: emacs[73681]/0#-1 LF=0
2022-09-12 10:08:59.202869-0400 emacs[73681:5354078] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=73681
2022-09-12 10:08:59.202981-0400 emacs[73681:5354078] SecTaskCopyDebugDescription: emacs[73681]/0#-1 LF=0
2022-09-12 10:08:59.203719-0400 emacs[73681:5354078] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=73681
2022-09-12 10:08:59.203806-0400 emacs[73681:5354078] SecTaskCopyDebugDescription: emacs[73681]/0#-1 LF=0
2022-09-12 10:09:00.482046-0400 emacs[73681:5354078] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=73681
2022-09-12 10:09:00.482123-0400 emacs[73681:5354078] SecTaskCopyDebugDescription: emacs[73681]/0#-1 LF=0
2022-09-12 10:09:00.482929-0400 emacs[73681:5354078] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=73681
2022-09-12 10:09:00.482997-0400 emacs[73681:5354078] SecTaskCopyDebugDescription: emacs[73681]/0#-1 LF=0
emacs was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 73681 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x0000000100154d30 emacs`process_mark_stack(base_sp=0) at alloc.c:7013:14 [opt]
   7010              "cold" and do not have mark bits.  */
   7011           if (pdumper_object_p (XFLOAT (obj)))
   7012             eassert (pdumper_cold_object_p (XFLOAT (obj)));
-> 7013           else if (!XFLOAT_MARKED_P (XFLOAT (obj)))
   7014             XFLOAT_MARK (XFLOAT (obj));
   7015           break;
   7016
Target 0: (emacs) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x0000000100154d30 emacs`process_mark_stack(base_sp=0) at alloc.c:7013:14 [opt]
    frame #1: 0x0000000100154753 emacs`mark_object(obj=<unavailable>) at alloc.c:7035:3 [opt] [artificial]
    frame #2: 0x00000001000fc810 emacs`mark_kboards at keyboard.c:13266:4 [opt]
    frame #3: 0x0000000100153c6e emacs`garbage_collect at alloc.c:6187:3 [opt]
    frame #4: 0x0000000100153593 emacs`maybe_garbage_collect at alloc.c:6090:5 [opt] [artificial]
    frame #5: 0x000000010017d113 emacs`eval_sub [inlined] maybe_gc at lisp.h:5564:5 [opt]
    frame #6: 0x000000010017d101 emacs`eval_sub(form=0x0000000102a1cd73) at eval.c:2423 [opt]
    frame #7: 0x00000001001ae239 emacs`readevalloop(readcharfun=0x0000000000007470, infile0=0x00007ff7bfefe8d8, sourcename=0x0000000101fcc354, printflag=false, unibyte=<unavailable>, readfun=0x0000000000000000, start=0x0000000000000000, end=0x0000000000000000) at lread.c:2339:15 [opt]
    frame #8: 0x00000001001ac3b4 emacs`Fload(file=<unavailable>, noerror=0x0000000000000000, nomessage=<unavailable>, nosuffix=0x0000000000000000, must_suffix=<unavailable>) at lread.c:0:9 [opt]
    frame #9: 0x00000001001ae4cd emacs`save_match_data_load(file=<unavailable>, noerror=<unavailable>, nomessage=<unavailable>, nosuffix=<unavailable>, must_suffix=<unavailable>) at lread.c:1630:24 [opt]
    frame #10: 0x0000000100180182 emacs`Fautoload_do_load [inlined] load_with_autoload_queue(file=<unavailable>, noerror=0x0000000000000000, nomessage=<unavailable>, nosuffix=0x0000000000000000, must_suffix=<unavailable>) at eval.c:2301:7 [opt]
    frame #11: 0x00000001001800e9 emacs`Fautoload_do_load(fundef=0x000000010254ff53, funname=0x00000000018f98d0, macro_only=<unavailable>) at eval.c:2347 [opt]
    frame #12: 0x0000000100183692 emacs`funcall_subr(subr=0x00000001002c7350, numargs=2, args=<unavailable>) at eval.c:3056:15 [opt]
    frame #13: 0x00000001001ce200 emacs`exec_byte_code(fun=<unavailable>, args_template=<unavailable>, nargs=2, args=<unavailable>) at bytecode.c:809:14 [opt]
    frame #14: 0x0000000100183ca7 emacs`funcall_lambda [inlined] fetch_and_exec_byte_code(fun=<unavailable>, args_template=<unavailable>, nargs=<unavailable>, args=<unavailable>) at eval.c:3101:10 [opt] [artificial]
    frame #15: 0x000000010018354d emacs`funcall_general(fun=<unavailable>, numargs=<unavailable>, args=<unavailable>) at eval.c:0 [opt] [artificial]
    frame #16: 0x000000010017fb1c emacs`Ffuncall(nargs=<unavailable>, args=0x0000000105800388) at eval.c:3014:21 [opt]
    frame #17: 0x00000001001ce200 emacs`exec_byte_code(fun=<unavailable>, args_template=<unavailable>, nargs=2, args=<unavailable>) at bytecode.c:809:14 [opt]
    frame #18: 0x0000000100183ca7 emacs`funcall_lambda [inlined] fetch_and_exec_byte_code(fun=<unavailable>, args_template=<unavailable>, nargs=<unavailable>, args=<unavailable>) at eval.c:3101:10 [opt] [artificial]
    frame #19: 0x000000010018354d emacs`funcall_general(fun=<unavailable>, numargs=<unavailable>, args=<unavailable>) at eval.c:0 [opt] [artificial]
    frame #20: 0x00000001001ce0e0 emacs`exec_byte_code(fun=<unavailable>, args_template=<unavailable>, nargs=0, args=<unavailable>) at bytecode.c:811:14 [opt]
    frame #21: 0x0000000100183ca7 emacs`funcall_lambda [inlined] fetch_and_exec_byte_code(fun=<unavailable>, args_template=<unavailable>, nargs=<unavailable>, args=<unavailable>) at eval.c:3101:10 [opt] [artificial]
    frame #22: 0x0000000100182456 emacs`apply_lambda(fun=0x00000001039bfd05, args=<unavailable>, count=(bytes = 128)) at eval.c:3123:9 [opt]
    frame #23: 0x000000010017d50c emacs`eval_sub(form=<unavailable>) at eval.c:0 [opt]
    frame #24: 0x000000010018220e emacs`Feval(form=0x00000001042c17d3, lexical=<unavailable>) at eval.c:2375:28 [opt]
    frame #25: 0x00000001000fc8a5 emacs`top_level_2 at keyboard.c:1141:10 [opt] [artificial]
    frame #26: 0x00000001001808d4 emacs`internal_condition_case(bfun=(emacs`top_level_2 at keyboard.c:1140), handlers=<unavailable>, hfun=(emacs`cmd_error at keyboard.c:935)) at eval.c:1497:25 [opt]
    frame #27: 0x00000001000fc85d emacs`top_level_1(ignore=0x0000000000000000) at keyboard.c:1149:5 [opt]
    frame #28: 0x000000010018026a emacs`internal_catch(tag=<unavailable>, func=(emacs`top_level_1 at keyboard.c:1146), arg=0x0000000000000000) at eval.c:1220:25 [opt]
    frame #29: 0x00000001002643d6 emacs`recursive_edit_1.cold.1 at keyboard.c:1109:2 [opt]
    frame #30: 0x00000001000e7779 emacs`recursive_edit_1 [inlined] command_loop at keyboard.c:1107:5 [opt]
    frame #31: 0x00000001000e7774 emacs`recursive_edit_1 at keyboard.c:719 [opt]
    frame #32: 0x00000001000e78f8 emacs`Frecursive_edit at keyboard.c:802:3 [opt]
    frame #33: 0x00000001000e6823 emacs`main(argc=<unavailable>, argv=<unavailable>) at emacs.c:2517:3 [opt]
    frame #34: 0x000000010092d52e dyld`start + 462
(lldb) up
frame #1: 0x0000000100154753 emacs`mark_object(obj=<unavailable>) at alloc.c:7035:3 [opt] [artificial]
   7032 {
   7033   ptrdiff_t sp = mark_stk.sp;
   7034   mark_stack_push_value (obj);
-> 7035   process_mark_stack (sp);
   7036 }
   7037
   7038 void
(lldb) up
frame #2: 0x00000001000fc810 emacs`mark_kboards at keyboard.c:13266:4 [opt]
   13263                  mark_object (event->ie.x);
   13264                  mark_object (event->ie.y);
   13265                  mark_object (event->ie.frame_or_window);
-> 13266                  mark_object (event->ie.arg);
   13267
   13268                  /* This should never be allocated for a single event, but
   13269                     mark it anyway in the situation where the list of devices
(lldb) up
frame #3: 0x0000000100153c6e emacs`garbage_collect at alloc.c:6187:3 [opt]
   6184   mark_pinned_symbols ();
   6185   mark_lread ();
   6186   mark_terminals ();
-> 6187   mark_kboards ();
   6188   mark_threads ();
   6189 #ifdef HAVE_PGTK
   6190   mark_pgtkterm ();
(lldb) 
--8<---------------cut here---------------end--------------->8---

the "good" part is that, apparently, I can reproduce the crash on demand.
the bad part is that it, apparently, requires my extensive .emacs.
Moreover, `emacs -Q` and loading .emacs and desktop by hand do _not_
produce the crash.
Moreover, the specific desktop file doesn't really matter either.

Please tell me if there anything else I can do.

Thank you.

In GNU Emacs 29.0.50 (build 2, x86_64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.5.1 (Build 21G83)) of 2022-09-12 built on
 3c22fb11fdab.ant.amazon.com
Repository revision: 82530902931416603340feb32cb186173ec2d46d
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.5.1

Configured using:
 'configure --with-imagemagick --with-mailutils --with-ns
 PKG_CONFIG_PATH='

Configured features:
ACL GIF GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY
KQUEUE NS PDUMPER PNG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP ZLIB

Important settings:
  value of $LANG: C
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  shell-dirtrack-mode: t
  remember-notes-mode: t
  global-edit-server-edit-mode: t
  winner-mode: t
  which-function-mode: t
  url-handler-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort bbdb-message mailalias cookie1 flyspell ispell
display-fill-column-indicator mail-extr gnus-msg gnus-art mm-uu mml2015
mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku
url-file svg dom browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud
nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range
gnus-win emacsbug message mailcap yank-media puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode
mm-bodies mm-encode mail-parse rfc2231 gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums add-log vc-hg vc-git diff-mode easy-mmode
vc-bzr vc-dispatcher tramp-cache time-stamp tramp-sh tramp
tramp-loaddefs trampver tramp-integration cus-edit pp cus-start files-x
tramp-compat rx shell pcomplete comint ansi-color parse-time iso8601
ls-lisp format-spec remember midnight warnings icons gnus nnheader
gnus-util text-property-search time-date mail-utils range mm-util
mail-prsvr wid-edit bbdb-mua bbdb-com crm mailabbrev bbdb bbdb-site
timezone modus-vivendi-theme modus-themes pcase edit-server advice
server winner ring which-func imenu edebug debug backtrace help-mode
find-func url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile
cconv url-vars help-at-pt desktop frameset cl-loaddefs cl-lib cus-load
info bbdb-autoloads edit-server-autoloads ein-autoloads elpy-autoloads
company-autoloads fb2-reader-autoloads async-autoloads f-autoloads
dash-autoloads markdown-mode-autoloads polymode-autoloads
request-autoloads s-autoloads websearch-autoloads with-editor-autoloads
compat-autoloads yaml-mode-autoloads yasnippet-snippets-autoloads rmc
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads kqueue
cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 366335 22931)
 (symbols 48 22356 0)
 (strings 32 182729 8975)
 (string-bytes 1 4526991)
 (vectors 16 57705)
 (vector-slots 8 822143 10079)
 (floats 8 282 104)
 (intervals 56 530 11)
 (buffers 1000 14))

-- 
Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://www.dhimmitude.org https://jij.org https://fairforall.org
Complete tolerance is impossible: it is insulting to bigots.