unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Thiago Melo <tmdmelo@gmail.com>
Cc: 63589@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#63589: [PATCH] 29.0.91; crash after creating graphical frames via emacsclient when compiled with cairo-xcb
Date: Tue, 23 May 2023 08:30:49 +0800	[thread overview]
Message-ID: <874jo3yjly.fsf@yahoo.com> (raw)
In-Reply-To: <CABpoeKjWbc+L8AJCVxkTRyF9atAdK1xH0KdqFe5Qx2virq2pNA@mail.gmail.com> (Thiago Melo's message of "Mon, 22 May 2023 19:21:36 +0000")

Thiago Melo <tmdmelo@gmail.com> writes:

>> > > > > What is the kind of situations in which these crashes could happen?
>> > > >
>> > > > Precisely that described in this bug report: when displays are closed
>> > > > and reopened within a short time period.
>> > >
>> > > What kind of user-level situations could cause this?  Is invoking
>> > > emacsclient soon after deleting the last visible frame the only one?
>> > > And what does "short time period" mean, quantitatively? milliseconds?
>> > > seconds? minutes?
>> >
>> > Sorry, in my experience it seems that the time interval between
>> > closing the display and opening it again doesn't matter. It seems to
>> > be more about the amount of times that the display is closed and then
>> > opened (which is often 3 times for me, for whatever reason).
>> >
>> > I'm testing it here again with Xvfb and an automation script, with a
>> > 10 minutes delay after creating a single graphical frame, and another
>> > 10 minutes delay after closing it and before creating a new one. I'll
>> > report the results soon.
>> >
>> > Also, this bug seems more likely to happen when emacs is built without
>> > a toolkit (which is was I've been testing so far), since the display
>> > is always closed after the last graphical frame is closed. Which made
>> > me realize, after looking at frame.c, that this bug might as well join
>> > the family of Bug#5802, Bug#21509, Bug#23499, and Bug#27816.
>>
>> With 10 minutes intervals, I got the X errors previously mentioned by
>> the 3rd time the display was opened, and then emacs crashed by the 5th
>> time the display was opened. So, assuming that 10 minutes is close
>> enough to infinity, we can say that the time interval doesn't matter.
>
> So, trying to gather everything into a summary here.
>
> To trigger the bug, all the following conditions must be met:
>
> - Emacs built without a toolkit
> - Emacs built with Cairo-XCB
> - Emacs started in daemon mode
> - The user closes all graphical frames and creates a new one (manually
> or programatically, duration in between doesn't matter, amount of
> times is not certain)
>
> It goes into the `delete_frame' -> `Fdelete_terminal' ->
> `x_delete_terminal' -> `XCloseDisplay' path, where cairo-xcb
> references are not destroyed, leading to X errors and emacs crashing.
>
> What else I've tested so far, that didn't trigger the bug:
>
> - Closing the X Server
> - xkill'ing graphical frames
>
> These two cases go into the `x_connection_closed' ->
> `Fdelete_terminal' -> `x_delete_terminal' path, where `XCloseDisplay'
> is not called.
>
> Other builds I've tested, that didn't trigger the bug:
>
> - GTK + Cairo-XCB
> - Lucid + Cairo-XCB
>
> Which doesn't end up calling XCloseDisplay, since the terminal is not
> deleted when the last graphical frame is closed (due to the infamous
> longstanding GTK bug, Bug#5802, Bug#21509, Bug#23499, and Bug#27816).
>
> Considering all the above, I propose this smaller (and potentially
> temporary) patch:
>
> #+begin_src diff
> --- a/src/frame.c    2023-05-22 19:52:25.155145242 +0200
> +++ b/src/frame.c    2023-05-22 20:13:41.548566364 +0200
> @@ -2206,14 +2206,15 @@
>      /* If needed, delete the terminal that this frame was on.
>         (This must be done after the frame is killed.)  */
>      terminal->reference_count--;
> -#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
> +#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (USE_CAIRO_XCB)
>      /* FIXME: Deleting the terminal crashes emacs because of a GTK
>         bug.
>         https://lists.gnu.org/r/emacs-devel/2011-10/msg00363.html */
>
>      /* Since a similar behavior was observed on the Lucid and Motif
> -       builds (see Bug#5802, Bug#21509, Bug#23499, Bug#27816), we now
> -       don't delete the terminal for these builds either.  */
> +       builds (see Bug#5802, Bug#21509, Bug#23499, Bug#27816), and builds
> +       without a toolkit together with Cairo-XCB support (Bug#63589),
> +       we now don't delete the terminal for these builds either.  */
>      if (terminal->reference_count == 0
>      && (terminal->type == output_x_window
>          || terminal->type == output_pgtk))
> #+end_src

We want closing displays (think x-delete-terminal) to still work on such
builds if the user uses it.





  reply	other threads:[~2023-05-23  0:30 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 11:17 bug#63589: 29.0.91; crash after creating graphical frames via emacsclient when compiled with cairo-xcb Thiago Melo
2023-05-20  1:46 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-20 11:47   ` Thiago Melo
2023-05-21  0:42     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-21 18:25       ` Thiago Melo
2023-05-20 22:47 ` bug#63589: [PATCH] " Thiago Melo
2023-05-21 13:40   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-21 14:30     ` Eli Zaretskii
2023-05-21 16:10       ` Thiago Melo
2023-05-21 17:42         ` Eli Zaretskii
2023-05-22  0:56           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-22  2:48             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-22 10:59               ` Eli Zaretskii
2023-05-22 11:17                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-22 11:40                   ` Eli Zaretskii
2023-05-22 12:07                     ` Thiago Melo
2023-05-22 13:12                       ` Thiago Melo
2023-05-22 19:21                         ` Thiago Melo
2023-05-23  0:30                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-23 11:37                             ` Eli Zaretskii
2023-05-23 12:08                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-23 13:01                                 ` Eli Zaretskii
2023-05-23 13:18                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-23 14:20                                     ` Eli Zaretskii
2023-05-24  0:22                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-24  2:30                                         ` Eli Zaretskii
2023-05-24  3:13                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-24  5:15                                             ` Thiago Melo
2023-05-24 11:07                                               ` Eli Zaretskii
2023-05-24 11:54                                                 ` Thiago Melo
2023-05-24 12:15                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-24 14:16                                                     ` Thiago Melo
2023-05-24 15:44                                                     ` Eli Zaretskii
2023-05-25  0:18                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-25  3:38                                                         ` Eli Zaretskii
2023-05-25  6:08                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-25  7:12                                                             ` Eli Zaretskii
2023-05-25 10:24                                                               ` Thiago Melo
2023-05-25 10:32                                                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-25 14:06                                                                   ` Thiago Melo
2023-05-25 18:17                                                                     ` Thiago Melo
2023-05-26  0:59                                                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-26  5:06                                                                       ` Thiago Melo
2023-05-26  6:14                                                                       ` Eli Zaretskii
2023-05-25 10:34                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-25 11:33                                                                 ` Eli Zaretskii
2023-05-26  0:23                                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-26  6:10                                                                     ` Eli Zaretskii
2023-05-26  8:01                                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-26  8:34                                                                         ` Eli Zaretskii
2023-05-24 11:01                                             ` Eli Zaretskii
2023-05-21 16:09     ` Thiago Melo
2023-05-22  1:05       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-22  5:23         ` Thiago Melo
2023-05-28  3:10 ` bug#63589: " Andrés Ramírez
2023-05-28  3:34 ` Andrés Ramírez
2023-05-28  5:55   ` Eli Zaretskii
2023-05-29 14:51     ` andrés ramírez
2023-05-28 21:23 ` Thiago Melo
2023-05-29 14:58   ` andrés ramírez
2023-05-29 15:21     ` Thiago Melo
2023-05-29 15:37       ` andrés ramírez
2023-05-29 16:10         ` Thiago Melo
2023-05-29 16:21           ` andrés ramírez

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=874jo3yjly.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=63589@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=tmdmelo@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).