Subject: bug#56967: 29.0.50; Frequent crashes under Wayland

From: Po Lu <[email-masked]>
Date: Mon, 08 Aug 2022 10:40:30 +0800

Bjoern Bidar <[email-masked]> writes:

> I did I had my hole session running, nothing else had that issue.
> I kept the GTK-Demo running nothing happened it ran just fine.

Thanks.

> After a few hours Emacs exited with the same behaviour as explained in the 
> bug.

Do you see the same if you run Emacs as something other a daemon?

> I on the #gtk channel on what do and I got from ebassi that it is ok to just 
> call _exit.
> He says it might be the client behaving wrong:
> <ebassi> Thaodan: It could happen because the client made an invalid request—
> Wayland mandates that the display server closes the connection in that case

We don't make raw Wayland requests anywhere, so it must be a bug in GTK.

> <ebassi> And if you lose the socket then you'
> <ebassi> you'll have to find the new one and reconnect
> <ebassi> Thaodan: Only emacs does that
> <ebassi> Pretty much literally
> <Thaodan> "that"?
> <ebassi> "app may run longer or before the compositor starts"
> <ebassi> Because emacs is really a 1980s teletype app
> <Thaodan> What does that change? calling _exit is not a solution.
> <Thaodan> Lets assume the fault for this happening is emacs, what could cause 
> this?

Outdated information.  The PGTK port of Emacs doesn't do anything close
to that, because GTK doesn't let us.

> <ebassi> Calling exit is perfectly acceptable: the display connection is 
> severed, and that can happen for multiple reasons, including the display 
> server going away
> <ebassi> There's no "the display server is still running, but it closed the 
> socket" mechanism for the toolkit to use

So why not use exit, which lets the atexit handlers run?

> <ebassi> The socket got closed
> <ebassi> The toolkit terminates
> <ebassi> Thaodan: It could happen because the client made an invalid request—
> Wayland mandates that the display server closes the connection in that case
> <ebassi> Or the display server decided to kill the client because it was 
> unresponsive
> <Thaodan> Why should the toolkit/lib call exit isn't there any better 
> mechanism to doing such a thing in glib or gtk for that matter? 
> <Thaodan> It would be better to not need any hacks to prevent gtk from killing 
> apps.
> <ebassi> Thaodan: There is no such mechanism
> <Thaodan> ebassi: OK so what's the idea behind using _exit as a mechanism, 
> doesn't that break any other app that has state so safe too? like for example 
> an office application that wants to safe it's data before going down.
> <ebassi> I already told you
> <ebassi> If the display connection is closed by the server, then there's no 
> safe way to store the data

Store the data that is in Emacs core??  How did these people learn to
write software?