Subject: feature/native-comp (master?): temacs crash in GC during mark phase
From: Andrea Corallo <[email-masked]>
To: [email-masked]
Cc: Nicolas Bértolo <[email-masked]>, Paul Eggert <[email-masked]>
Date: Sun, 07 Jun 2020 20:16:08 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I'm experiencing non reproducible GC related crashes building
feature/native-comp.

Both back-traces I've got looks similar:

#0  0x00000000004dfe4c in symbol_marked_p (s=0xb4f0) at pdumper.h:149
#1  mark_object (arg=<optimized out>) at alloc.c:6731
#2  0x0000000000552390 in traverse_intervals_noorder (tree=0xffffffffe070,
    function=0x4e0fe0 <mark_interval_tree_1>, arg=0x0) at intervals.c:234
#3  0x00000000004e0060 in mark_object (arg=<optimized out>) at alloc.c:6784
#4  0x00000000004e08ec in mark_memory (end=<optimized out>, start=<optimized out>)
    at alloc.c:4860
#5  mark_stack (bottom=<optimized out>, end=end@entry=0xffffffff71d0 "")
    at alloc.c:5071
#6  0x000000000055fd48 in mark_one_thread (thread=0x903b80 <main_thread>)
    at thread.c:630
#7  mark_threads_callback (ignore=<optimized out>) at thread.c:661
#8  0x00000000004e1238 in garbage_collect () at alloc.c:6101
#9  0x00000000004ff874 in maybe_gc () at lisp.h:5090
#10 eval_sub (form=form@entry=XIL(0xcefe63)) at eval.c:2243
#11 0x0000000000500108 in Fwhile (args=<optimized out>) at eval.c:1013
...

During: ./temacs --batch  -l loadup --temacs=pbootstrap

Not sure why but this looks easier to reproduce on aarch64 (even if most
of the times is still bootstraping clean).

IIUC in this case we are trying to access (struct Lisp_Symbol *) 0xb4f0
but the memory cannot be accessed.  The address looks quite odd to me
and infact checking with 'info proc mappings' the lowest mapped memory
seams to start at 0x400000.

So far I was not able to reproduce on X86_64 (where I've rr).

This may not be related to feature/native-comp but to one of the recent
GC changes and the stack marking strategy.

I suspect Nicolas may be observing the same issue on Windows
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-06/msg00320.html

I'll keep on looking into this.

Regards

  Andrea

In GNU Emacs 28.0.50 (build 1, aarch64-unknown-linux-gnu)
 of 2020-06-06 built on
Repository revision: 3d576c784b3fa01b4d6b33a4172351b7c3a61660
Repository branch: HEAD
System Description: Ubuntu 18.04.3 LTS

Recent messages:
Grep finished with 2 matches found
Current locus from *grep*
Mark set [2 times]
Reverting buffer ‘Makefile’.
Mark set [2 times]
Mark saved where search started
Mark set [4 times]
File GTAGS not found. Run 'gtags'? (y or n) y
Quit [2 times]
No match

Configured using:
 'configure --with-nativecomp --with-x-toolkit=no --with-xpm=ifavailable
 --with-jpeg=ifavailable --with-png=ifavailable --with-gif=ifavailable
 --with-tiff=ifavailable --with-gnutls=ifavailable --with-nativecomp
 --prefix=/home/koral'

Configured features:
SOUND NOTIFY INOTIFY ZLIB MODULES THREADS PDUMPER GMP

Important settings:
  value of $LC_ALL: en_US.utf8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  savehist-mode: t
  global-ede-mode: t
  beacon-mode: t
  global-git-gutter-mode: t
  global-whitespace-mode: t
  delete-selection-mode: t
  async-bytecomp-package-mode: t
  helm--remap-mouse-mode: t
  show-paren-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  display-time-mode: t
  which-key-mode: t
  projectile-mode: t
  global-company-mode: t
  company-mode: t
  global-flycheck-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/lisp/verilog-mode hides /home/koral/share/emacs/28.0.50/lisp/progmodes/verilog-mode

Features:
(shadow sort mail-extr emacsbug sendmail find-dired make-mode help-fns
radix-tree git-rebase vc-annotate vc vc-dispatcher two-column iso-transl
semantic/db-file data-debug cedet-files ede/locate semantic/lex-spp
vc-git bug-reference macrostep-c cmacexp macrostep hideshow misearch
multi-isearch magit-extras magit-bookmark magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log magit-diff smerge-mode diff-mode
magit-core magit-autorevert magit-margin magit-transient magit-process
git-commit log-edit message rmc puny rfc822 mml mml-sec epa derived epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader pcvs-util add-log with-editor ffap tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
parse-time iso8601 ls-lisp ivy colir ivy-overlay cus-start cus-load
ede/emacs semantic/db semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local ede/dired mule-util
recentf tree-widget helm-x-files helm-sys term/xterm xterm paredit gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr wdired dired dired-loaddefs
sanityinc-tomorrow-eighties-theme color-theme-sanityinc-tomorrow color
elisp-slime-nav ob-lisp org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete pcomplete
org-list org-faces org-entities time-date noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs server savehist ede/speedbar
ede/files ede ede/detect ede/base ede/auto ede/source eieio-base
eieio-speedbar speedbar ezimage dframe eieio-custom wid-edit cedet
beacon elisp-depend google-translate google-translate-default-ui
google-translate-core-ui google-translate-core google-translate-tk
google-translate-backend git-gutter helm-gtags pulse which-func imenu
whitespace bash-completion vlf vlf-base vlf-tune flex-mode jison-mode
bison-mode cc-mode cc-guess cc-menus cc-cmds cc-styles cc-align cc-fonts
cc-engine cc-vars cc-defs git f s helm-git-grep delsel magit-mode
magit-git magit-utils crm magit-section transient helm-swoop ido
helm-command helm-elisp helm-eval edebug backtrace helm-for-files
helm-bookmark helm-adaptive helm-info bookmark text-property-search pp
helm-external helm-net xml url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap helm-mode
helm-files helm-buffers helm-occur helm-tags helm-locate helm-grep
helm-regexp format-spec helm-utils helm-help helm-types helm-config
helm-easymenu async-bytecomp helm helm-source eieio-compat
helm-multi-match helm-lib async paren undo-tree diff winner windmove
autorevert filenotify ibuf-macs time image which-key advice projectile
grep compile ibuf-ext ibuffer ibuffer-loaddefs thingatpt company-oddmuse
company-keywords company-etags etags fileloop generator xref project
company-gtags company-dabbrev-code company-dabbrev company-files
company-capf company-cmake company-xcode company-clang company-semantic
company-eclim company-template company-bbdb company pcase flycheck
find-func dash gcmh comp rx cl-extra help-mode k-utils gud easy-mmode
comint regexp-opt ansi-color ring edmacro kmacro slime-autoloads info
tool-bar package easymenu browse-url url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json
subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer 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 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 threads inotify multi-tty make-network-process emacs)

Memory information:
((conses 16 2475879 106891)
 (symbols 48 40051 2)
 (strings 32 181600 47924)
 (string-bytes 1 9741313)
 (vectors 16 77416)
 (vector-slots 8 1228210 168271)
 (floats 8 780 7731)
 (intervals 56 158344 397)
 (buffers 992 56))