gnome-terminal freezing, then crashing

Bug #2049923 reported by Ralf Hildebrandt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-terminal (Ubuntu)
New
Undecided
Unassigned

Bug Description

First: It's very hard to reproduce, but it happens to me about once per week.
If often open new windows or split windows out from tabs. And then it happens. First it becomes unresponsive, and then after about 2-3 seconds it simply closes all instances.

[328830.780749] gnome-terminal-[117706]: segfault at 4600000742 ip 00007fdb2fb45611 sp 00007ffdb8c5fda0 error 4 in libgtk-3.so.0.2406.32[7fdb2f883000+38f000] likely on CPU 4 (core 4, socket 0)

[328830.780761] Code: fb 48 83 ec 20 64 48 8b 04 25 28 00 00 00 48 89 44 24 18 31 c0 e8 bf 6d ff ff 48 85 db 74 7a 48 89 c6 48 8b 03 48 85 c0 74 05 <48> 39 30 74 0c 48 89 df e8 a2 c2 d4 ff 85 c0 74 5e 48 89 e6 48 89

[329377.925310] gnome-terminal-[120116]: segfault at 2f00000774 ip 00007f86af745611 sp 00007ffc9943c5c0 error 4 in libgtk-3.so.0.2406.32[7f86af483000+38f000] likely on CPU 2 (core 2, socket 0)

[329377.925324] Code: fb 48 83 ec 20 64 48 8b 04 25 28 00 00 00 48 89 44 24 18 31 c0 e8 bf 6d ff ff 48 85 db 74 7a 48 89 c6 48 8b 03 48 85 c0 74 05 <48> 39 30 74 0c 48 89 df e8 a2 c2 d4 ff 85 c0 74 5e 48 89 e6 48 89

unfortunately, apport isn't automatically creating a crash report.

ProblemType: Bug
DistroRelease: Ubuntu 23.10
Package: gnome-terminal 3.49.92-2ubuntu1
ProcVersionSignature: Ubuntu 6.5.0-14.14-generic 6.5.3
Uname: Linux 6.5.0-14-generic x86_64
ApportVersion: 2.27.0-0ubuntu5
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Fri Jan 19 16:48:43 2024
SourcePackage: gnome-terminal
UpgradeStatus: Upgraded to mantic on 2023-10-17 (94 days ago)

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :
Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

What do you mean by "split windows out from tabs"? Do you mean right-clicking on the tab and choosing "Detach Terminal"?

Do I understand correctly that the freeze and crash always happens right after opening a new window or detaching a tab? Does the new window appear before the freeze or not?

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote : Re: [ext] [Bug 2049923] Re: gnome-terminal freezing, then crashing

* Egmont Koblinger <email address hidden>:
> What do you mean by "split windows out from tabs"? Do you mean right-
> clicking on the tab and choosing "Detach Terminal"?

Exactly.

> Do I understand correctly that the freeze and crash always happens right
> after opening a new window or detaching a tab?

It's really hard to find out, since the error occurs so sporadically
AND one doesn't always notice the "freezing" in that very moment.

> Does the new window
> appear before the freeze or not?

I'll have to check this when it happens the next time

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :

* Ralf Hildebrandt <email address hidden>:

> I'll have to check this when it happens the next time

I found a way to reproduce (works every second to third time):

* open a new terminal
* type nothing into the terminal
* press CTRL-SHIT T to create a new tab
* change to that new tab
* type something; I mostly press RETURN three times
* detach that newly created tab

All open instances of gnome-termin terminal close after about half a second

--
Ralf Hildebrandt
Charité - Universitätsmedizin Berlin
Geschäftsbereich IT | Abteilung Netz | Netzwerk-Administration
Invalidenstraße 120/121 | D-10115 Berlin

Tel. +49 30 450 570 155
<email address hidden>
https://www.charite.de

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

> change to that new tab

This is a no-op because the new tab is automatically swithed to, correct?

---

Are you on Wayland or X11? This command should answer it:

echo $XDG_SESSION_TYPE

---

I cannot reproduce the crash. The steps to reproduce are very simple, so I believe we should have received more crash reports. There must be something weird, unique going on in your machine, at least that's what I suspect.

Have you customized your shell prompt, for example? It might be relevant. Or do you have unusually large or unusually small gnome-terminal windows, or anything nontypical in the terminal's default config?

---

I'd like to see a stack trace of the crash. Could you please do the following?

Open two terminals that are _not_ gnome-terminal. For example xterm. Make sure gnome-terminal is _not_ running.

In the first xterm, execute two:

ulimit -c unlimited
/usr/libexec/gnome-terminal-server

In the second xterm, within 10 seconds, execute:

gnome-terminal

You should see a gnome-terminal window appear as usual. Make it crash according to the aforementioned steps.

In the first window you should see a brief message including "core dumped".

In the directory /var/lib/apport/coredump you should see a freshly created file, mentioning gnome-terminal-server in its name. Verify its timestamp that it's indeed a freshly created one.

Run this command

gdb /usr/libexec/gnome-terminal-server /var/lib/apport/coredupmp/[the new filename of that core dump]

You might then need to press Enter a few times until you get a "(gdb)" prompt. There execute the command

bt full

You might again need to press Enter a few times to continue its output (if it asks to "Type <RET> for more"), until you get a "(gdb)" prompt again.

Then please copy-paste gdb's output here.

(There might be an easier way of getting this info using apport, but I'm not familiar with that. If you are then you can do that.)

Thanks in advance!

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :

* Egmont Koblinger <email address hidden>:
> > change to that new tab
>
> This is a no-op because the new tab is automatically swithed to,
> correct?

Indeed.

> ---
>
> Are you on Wayland or X11? This command should answer it:
>
> echo $XDG_SESSION_TYPE

$ echo $XDG_SESSION_TYPE
x11

I could check with wayland if you like

> I cannot reproduce the crash. The steps to reproduce are very simple, so
> I believe we should have received more crash reports. There must be
> something weird, unique going on in your machine, at least that's what I
> suspect.
>
> Have you customized your shell prompt, for example? It might be
> relevant.

Nope. It's
hildeb@vsw-it-nw-10:~$
username @ hostname

> Or do you have unusually large or unusually small gnome-
> terminal windows, or anything nontypical in the terminal's default
> config?

No, definitely not (site is about a quarter of the screen)

> I'd like to see a stack trace of the crash. Could you please do the
> following?

Will work on that. Do I have to kill re-existing gnome-terminal-server
processes?

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :

Here goes the backtrace - couldn't send it via email, since:

The message you sent included commands to modify the bug report,
but you didn't sign the message with an OpenPGP key that is
registered in Launchpad.

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :
Revision history for this message
Egmont Koblinger (egmont-gmail) wrote (last edit ):

Hmmmm.... trying to make sense of it...

There's hardly any code from gnome-terminal itself in the stack trace, most of them is from GTK.

#10 is from update_color_scheme():

  if (gdk_rgba_hash (&priv->bg_color) != gdk_rgba_hash (&bg))
    {
      priv->bg_color = bg;
      g_object_notify (G_OBJECT (screen), "bg-color"); <---- this line
    }

#0 gtk_widget_queue_draw() is called by #1 g_closure_invoke(), so the former is called as a callback registered earlier. The only place where this method can be registered as a callback is in terminal_screen_container_constructed():

  g_signal_connect_swapped (priv->screen, "notify::bg-color",
                            G_CALLBACK (gtk_widget_queue_draw), priv->vscrollbar);

and it's indeed about the same "bg-color" signal, so I'm quite sure this is where we are.

Now, this is not part of upstream gnome-terminal. It's added by Ubuntu's "scrollbar-background-theming.patch", as per lp:1493964, which tries to theme the scrollbar to match the terminal screen's main background color.

I suspect that toggling the scrollbar's visibility might eliminate this bug for you. Also, if you're familiar with recompiling Ubuntu packages with tiny modifications, I'm fairly confident that dropping this patch should fix the problem. Installed packages, modules, settings, whatnot related to GTK scrollbars (e.g. choosing whether to use an overlay or traditional one, etc.) might easily be relevant to whether this bug occurs.

I'm not an Ubuntu developer, and I'm not affiliated with Ubuntu or Launchpad. I'm a GNOME Terminal developer. At this point, I suspect with 99%+ certainity that upstream GNOME Terminal is not affected by the bug, it's introduced by Ubuntu (or maybe Debian). Therefore I'm sorry but I'm afraid I won't be able to help any further, the investigation and fixing should be continued by Ubuntu devs.

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :

"I suspect that toggling the scrollbar's visibility might eliminate this bug for you" -I'd like to try that, but where's that option hidden?

As for dropping the patch: I could try rebuilding, but for the time being I'd prefer the other option.

Revision history for this message
Ralf Hildebrandt (ralf-hildebrandt) wrote :

Found the option, will try with "Show scrollbar" DISABLED.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.