Subject: bug#50462: 27.2; emacsclient syntax highlight failure

From: RDS <[email-masked]>
Date: Tue, 7 Sep 2021 11:11:20 -0700

I have been using emacs-lucid as a server for a few months & encountered
repeated sporadic annoyances. What follows is somewhat vague because I
cannot give a precise repeatable sequence of operations which lead to the
particular fault. Nevertheless, what I describe has occurred on far too
instances. The machine is a Lenovo P15v Gen 1 with an i7 8c/16t CPU using
Intel UHD graphics. I have Slackware-current on one partition & Fedore 34
on another. While this report is from the former, the *identical* results
happen on the Fedora machine. Furthermore, it makes *no* difference whether
it runs in console or xterm.

Launch emacs as a server. A buffer has a bash or elisp script with
font-lock-mode enabled (syntax highlighting). It looks just fine. Then, I
switch to another buffer & when I return, part of the file is not visible.
Close inspection shows that only text encoded as strings is rendered
black-on-black or white-on-white. Disabling font-lock-mode shows nothing is
missing! Again enabling font-lock-mode & the same text is missing. Killing
the buffer & reloading does not fix the problem. At this point opening any
new bash or elisp file with strings is futile. The only way to correct all
is a restart of the daemon! Of course, any setup of screens / consoles is
lost. However, no data is ever lost or damaged.

Here is the general scenario

tty1> launch a server
emacs --daemon
or
emacs --fg-daemon
or
emacs  M-x server mode

tty2> run Midnight Commander
mc
navigate -> .bashrc (for example)
emacsclient -t .bashrc

tty3>
mc
navigate -> file1
emacsclient -t file1
navigate -> file2
emacsclient -t file2
.
.
.

Initially everything behaves as expected in console & X. Then on time
scales ranging from minutes to hours with the various emacsclients,
randomly switching among tty's & killing / loading buffers, I eventually
see that .bashrc is displayed with "missing" chars.

Attached are two screenshots (before & after failure) of my .bashrc from an
xterm.

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll
bars)
 of 2021-03-26 built on p15v.rr.net
System Description: Slackware 15.0 x86_64

Recent messages:
Loading smtpmail...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/man
 --infodir=/usr/info --localstatedir=/var --with-x
 --with-x-toolkit=lucid --with-mailutils --without-selinux --without-xim
 --without-libsystemd --disable-acl 'CFLAGS=-O2 -fPIC''

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY GNUTLS LIBXML2 FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS
LUCID X11 XDBE XIM MODULES THREADS PDUMPER LCMS2 GMP

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

Major mode: Dired by name

Minor modes in effect:
  gpm-mouse-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny format-spec rfc822 mml
easymenu mml-sec epa epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader dired dired-loaddefs t-mouse
term/linux derived edmacro kmacro paren smtpmail auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs cl-loaddefs cl-lib
password-cache json subr-x map seq byte-opt gv bytecomp byte-compile
cconv sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar 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 dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 53706 9734)
 (symbols 48 6947 1)
 (strings 32 18362 889)
 (string-bytes 1 604547)
 (vectors 16 9632)
 (vector-slots 8 108586 7664)
 (floats 8 20 299)
 (intervals 56 375 0)
 (buffers 1000 12))