unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Clemente <n142857@gmail.com>
Cc: 71176@debbugs.gnu.org
Subject: bug#71176: 30.0.50; Segmentation fault (SIGSEGV) in TTY+emacsclient, default_face is nil
Date: Sat, 25 May 2024 15:42:18 +0300	[thread overview]
Message-ID: <867cfiyset.fsf@gnu.org> (raw)
In-Reply-To: <CAJKAhPAtBR2R8PiW3hNkO51Ub9jO3D=NAdhFUVze3YGJd+5w5w@mail.gmail.com> (message from Daniel Clemente on Sat, 25 May 2024 11:04:18 +0000)

> From: Daniel Clemente <n142857@gmail.com>
> Date: Sat, 25 May 2024 11:04:18 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>
> 
> I found out how to reproduce this and a possible cause, see "garbage-collection-messages" below.
> 
> > > 6819      return default_face->id;
> > 
> > Do you use face-remapping?  Is face-remapping-alist non-nil when this
> > happens?  If so, can you show the value of Vface_remapping_alist?
> 
> I don't use it, and it's nil when the SIGSEGV happens.
> (gdb) p Vface_remapping_alist 
> $1 = XIL(0)
> 
> >> warning: Source file is more recent than executable.
> >        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > This is not a good sign: you have edited your sources after the Emacs
> > binary was produced, so some of the information in the backtrace and
> > the GDB session might be inaccurate or even incorrect.
> 
> My source branch was at yesterday's HEAD, sorry. There were only small recent changes in xfaces.c/xdisp.c.
> I now switched my branch to the commit I used to build Emacs (b82a003544c607b5c54bab13870d52), from 2
> weeks ago.
> I also recompiled using -O2 instead of -O3, thanks.
> 
> With that, and by opening+closing many frames in succession (details at bug#71177), I made it crash.
> Backtrace attached below.
> 
> I was able to consistently reproduce the crash by running this command (30 seconds is always enough to
> reproduce it, but it also happens after less than 10 secons, so you may change the 30 to a lower number):
> 
> for j in `seq 30`; do for i in `seq 10`; do urxvt -e emacsclient '-nw' '-e' '(dired "~")' &; done; sleep 1 && killall
> emacsclient; done
> 
> I couldn't reproduce it under emacs -Q
> The minimal .emacs needed to reproduce it has these 2 lines:
> 
> (setq garbage-collection-messages t)
> (set-face-foreground 'default "#bbb")

Thanks.  Please try the stab-in-the-dark patch below.

diff --git a/src/xfaces.c b/src/xfaces.c
index 5192b22..8c07e5e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1041,13 +1041,17 @@ tty_lookup_color (struct frame *f, Lisp_Object color, Emacs_Color *tty_color,
 		  Emacs_Color *std_color)
 {
   Lisp_Object frame, color_desc;
+  specpdl_ref count;
 
   if (!STRINGP (color) || NILP (Ffboundp (Qtty_color_desc)))
     return false;
 
   XSETFRAME (frame, f);
 
+  count = SPECPDL_INDEX ();
+  specbind (Qinhibit_free_realized_faces, Qt);
   color_desc = call2 (Qtty_color_desc, color, frame);
+  unbind_to (count, Qnil);
   if (CONSP (color_desc) && CONSP (XCDR (color_desc)))
     {
       Lisp_Object rgb;
@@ -1076,7 +1080,10 @@ tty_lookup_color (struct frame *f, Lisp_Object color, Emacs_Color *tty_color,
 	      && !NILP (Ffboundp (Qtty_color_standard_values)))
 	    {
 	      /* Look up STD_COLOR separately.  */
+	      count = SPECPDL_INDEX ();
+	      specbind (Qinhibit_free_realized_faces, Qt);
 	      rgb = call1 (Qtty_color_standard_values, color);
+	      unbind_to (count, Qnil);
 	      if (! parse_rgb_list (rgb, std_color))
 		return false;
 	    }





  reply	other threads:[~2024-05-25 12:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 17:38 bug#71176: 30.0.50; Segmentation fault (SIGSEGV) in TTY+emacsclient, default_face is nil Daniel Clemente
2024-05-24 19:26 ` Eli Zaretskii
2024-05-25 11:04   ` Daniel Clemente
2024-05-25 12:42     ` Eli Zaretskii [this message]
2024-05-25 16:22       ` Daniel Clemente
2024-05-25 17:25         ` Eli Zaretskii
2024-05-25 17:48           ` Eli Zaretskii
2024-05-25 18:07             ` Eli Zaretskii
2024-05-26 10:58               ` Daniel Clemente
2024-05-26 11:04                 ` Daniel Clemente
2024-05-26 16:44                   ` Eli Zaretskii
2024-05-27 11:04                     ` Daniel Clemente
2024-05-27 12:39                       ` Eli Zaretskii
2024-05-26 17:55                 ` Eli Zaretskii
2024-05-27 11:05                   ` Daniel Clemente

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=867cfiyset.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71176@debbugs.gnu.org \
    --cc=n142857@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).