From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <867cfiyset.fsf@gnu.org> References: <86r0dr106n.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29205"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71176@debbugs.gnu.org To: Daniel Clemente Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 25 14:45:25 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sAqm4-0007RH-Ij for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 May 2024 14:45:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAqlg-000615-7b; Sat, 25 May 2024 08:45:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sAqlc-00060a-I4 for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 08:44:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sAqlb-0001ea-8W for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 08:44:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sAqli-0002gR-Nn for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 08:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 May 2024 12:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71176 X-GNU-PR-Package: emacs Original-Received: via spool by 71176-submit@debbugs.gnu.org id=B71176.171664109110264 (code B ref 71176); Sat, 25 May 2024 12:45:02 +0000 Original-Received: (at 71176) by debbugs.gnu.org; 25 May 2024 12:44:51 +0000 Original-Received: from localhost ([127.0.0.1]:43218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAqlX-0002fT-63 for submit@debbugs.gnu.org; Sat, 25 May 2024 08:44:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44228) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAqlV-0002f8-Cf for 71176@debbugs.gnu.org; Sat, 25 May 2024 08:44:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sAqjC-0001V7-C2; Sat, 25 May 2024 08:42:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iSSu1N/mJ7kP9TD/VTBzavSvbnfhphOY7YOGElx0Uqc=; b=MTtosBwPvwlH uenrW9UVmPBx8lLNZzbt9IAoQvqnYrvbYxw0fTUzyAZkeKyH1DhyPnszmhZoeCec4a2hiVLEuS9Fh MavI+lHJ9iBjuC4XGvrqUvjZVE2VqYfHJEpcXHp6ybHH+Bl7CDnwwwOv0uDMkmp8rVZkWxcLp6Z5o CWFv5oCdr+B4k/JZar3Lsq/IoYvLVljPzy/WP9wnXVR2VtIsi7SuUotvLMH8M0JTNImZpf6CXiCeR t4v9G7xH3i/BMPwA1vG391dtm7/FgxEeppC2dCFxoUqfOP5Zs/tpbBGrqFn7silFXja4xbuIwJK3v JgJVVt4/Bnv57HmdqdEtFg==; In-Reply-To: (message from Daniel Clemente on Sat, 25 May 2024 11:04:18 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285865 Archived-At: > From: Daniel Clemente > Date: Sat, 25 May 2024 11:04:18 +0000 > Cc: Eli Zaretskii > > 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; }