Bug 448447 - System Settings freezes and crashes when trying to open Cursors KCM when two installed themes inherit each other
Summary: System Settings freezes and crashes when trying to open Cursors KCM when two ...
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_cursortheme (other bugs)
Version First Reported In: 5.23.5
Platform: Manjaro Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-14 09:44 UTC by parash07theviper
Modified: 2022-07-10 22:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
attachment-6156-0.html (1.91 KB, text/html)
2022-01-15 04:27 UTC, parash07theviper
Details
gdb backtrace log of crash (16.70 KB, text/plain)
2022-02-03 11:11 UTC, jeois
Details
systemsettings5 rebuilt with debug still yields ?? (17.60 KB, text/x-log)
2022-02-03 22:31 UTC, jeois
Details
gdb backtrace with rebuilt debug symbols (9.81 KB, text/plain)
2022-02-03 23:19 UTC, jeois
Details

Note You need to log in before you can comment on or make changes to this bug.
Description parash07theviper 2022-01-14 09:44:45 UTC
KDE Version5.23.5
ArcoLinux

Steps to reproduce:
1. Open System Settings
2. Then Appearance
3. Then Global Theme
4. Then Cursors

Observed Results: System Settings freezes then after a while just closes

Expected Results: Open the Cursors themes available in the system.
Comment 1 parash07theviper 2022-01-14 09:49:10 UTC
The rest of the system is fine, and works fine. It only crashes on that page of the system settings. Plus mine is a fresh install.
Comment 2 Nate Graham 2022-01-14 21:18:03 UTC
Cannot reproduce. Can you attach a backtrace of the crash? See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
Comment 3 parash07theviper 2022-01-15 04:27:02 UTC
Created attachment 145480 [details]
attachment-6156-0.html

sorry, I cant, already uninstalled kde and went back to i3. But as far as i
remember, this crash was a bit different than your usual kde crashes, like
it didn't generate any crash report dialog box...it just hangs (only the
System Settings) while the cursor is busy, and after waiting for a while,
the System Settings just closes without any dialog box or crash report.

On Sat, Jan 15, 2022 at 3:03 AM Nate Graham <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=448447
>
> Nate Graham <nate@kde.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |nate@kde.org
>          Resolution|---                         |BACKTRACE
>              Status|REPORTED                    |NEEDSINFO
>
> --- Comment #2 from Nate Graham <nate@kde.org> ---
> Cannot reproduce. Can you attach a backtrace of the crash? See
>
> https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 4 Nate Graham 2022-01-15 04:30:12 UTC
I guess there's nothing we can do then. sorry. :/
Comment 5 jeois 2022-02-03 10:52:02 UTC
Please reopen this bug ticket, as I am often having this same crash of systemsettings5.

If I try to select Appearance>Cursors, my cursor will spin as busy, and then System Settings eventually times out and crashes. (Segmentation fault: Core dumped)

I have to assume the bug involves icon themes and/or cursor themes which are somehow incompatible because I fixed it before by removing theme packages.  This particular module (kcm_cursortheme) seems especially buggy because even when I fixed it, it would load very slowly and sometimes crash when I scrolled through the available cursor sets.  

Unfortunately, I haven't been able to pinpoint which theme is incompatible, and my attempts at sifting through the backtrace yielded no obvious culprit.  I'm willing to give the gdb backtrace another shot if someone will take a look at it please.
Comment 6 jeois 2022-02-03 11:11:10 UTC
Created attachment 146220 [details]
gdb backtrace log of crash

It appears to call something and gets stuck in an infinite loop, but I have no idea what is wrong.

I've truncated the log since same message appears 80,000+ times in the loop before it causes a seg fault.
Comment 7 Nate Graham 2022-02-03 16:03:23 UTC
Yikes.

Looks like the good stuff is here:

> #86939 0x00007ffff0756f25 in ?? () from /usr/lib/libXcursor.so.1
> #86940 0x00007ffff0756f25 in ?? () from /usr/lib/libXcursor.so.1
> #86941 0x00007ffff0756f25 in ?? () from /usr/lib/libXcursor.so.1
> #86942 0x00007ffff0756ff0 in XcursorLibraryLoadImage () from /usr/lib/libXcursor.so.1
> #86943 0x00007fffda0fea63 in ?? () from /usr/lib/qt/plugins/kcms/kcm_cursortheme.so
> #86944 0x00007fffda10034f in ?? () from /usr/lib/qt/plugins/kcms/kcm_cursortheme.so
> #86945 0x00007fffda10123d in ?? () from /usr/lib/qt/plugins/kcms/kcm_cursortheme.so

Unfortunately the backtrace is missing debug symbols, so we can't actually tell where exactly the problem is. Can you install some, reproduce the crash, and attach a new backtrace? Thanks!
Comment 8 jeois 2022-02-03 22:31:37 UTC
Created attachment 146241 [details]
systemsettings5 rebuilt with debug still yields ??

(In reply to Nate Graham from comment #7)

> Unfortunately the backtrace is missing debug symbols, so we can't actually
> tell where exactly the problem is. Can you install some, reproduce the
> crash, and attach a new backtrace? Thanks!

I was trying to do that last night, but I had difficulty obtaining the debug symbols.  

The distro's debug repos (Arch/Manjaro) don't include debug packages for 'systemsettings5' or 'libxcursor.'  
It should be in https://america.mirror.pkgbuild.com/extra-debug/os/x86_64/  
Worse, https://america.mirror.pkgbuild.com/kde-unstable-debug/os/x86_64/ is completely empty.

'debuginfod -find' yields "Server query failed: Function not implemented"
 
I rebuilt the "systemsettings" package to see if that'll get the debug symbols in this trace.  While we get more info towards the end of the trace, it still shows "??" for the libXcursors call.  Now, I'm not sure where gdb downloaded all the debug files for the qt5 plugins and such.  There was quite a few of them but the output log is impossible to read with download progress hashes.

I've only posted the last bit with the libxcursors call and the final crash because the backtrace log was massive.  Clearly, I need to rebuilt libxcursors with the debug option as well, but I'm struggling to do so:

   ~/Downloads/libxcursor/repos/extra-x86_64    packages/packages/libxcursor  makepkg                                                                                           ✔ 
==> Making package: libxcursor 1.2.0-2 (Thu 03 Feb 2022 04:21:10 PM CST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading libXcursor-1.2.0.tar.bz2...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  326k  100  326k    0     0   165k      0  0:00:01  0:00:01 --:--:--  165k
  -> Downloading libXcursor-1.2.0.tar.bz2.sig...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   543  100   543    0     0    556      0 --:--:-- --:--:-- --:--:--   555
  -> Found index.theme
==> Validating source files with sha512sums...
    libXcursor-1.2.0.tar.bz2 ... Passed
    libXcursor-1.2.0.tar.bz2.sig ... Skipped
    index.theme ... Passed
==> Verifying source file signatures with gpg...
    libXcursor-1.2.0.tar.bz2 ... FAILED (unknown public key CFDF148828C642A7)
==> ERROR: One or more PGP signatures could not be verified!

Arch is starting to annoy me with this package system.  How am I supposed to get the authorized public key list or how do I disable integrity check?
Comment 9 Nate Graham 2022-02-03 22:34:10 UTC
I can't help you with Arch packaging issues, sorry. I'm not familiar with it.
Comment 10 jeois 2022-02-03 23:19:59 UTC
Created attachment 146242 [details]
gdb backtrace with rebuilt debug symbols

Don't worry about that.  Sorry, I was just grumbling... 

I managed to get libxcursors rebuilt with the debug option.  Do you know where gdb downloaded all the additional debug files from dependencies that I didn't rebuild myself?  Regardless, it's not important for now.

In any case, we can FINALLY see what is it's trying to do.  It looks like it's scanning for the these cursor themes directories; perhaps for an "ibeam" cursor.   In this trace, I didn't wait for it to run its course since it was taking even longer to timeout of the loop and seg fault.  I killed it manually.

Most importantly, do you know why kcm_cursortheme keeps calling libxcursor scanning in a loop?  
Thanks for your consideration.
Comment 11 jeois 2022-02-04 00:19:44 UTC
Thanks to the backtrace, I managed to narrow down the incompatible icon themes.  I should have known it involves these these since the OP was using Arcolinux.

The issue involves both "Sardi" and "Surfn" inheriting from each other.  In fact, deleting that link solves my problem.  Once I edit "... icons/Surfn/index.theme" and remove 'Sardi' from its Inherits line, the crash goes away.

Do you think this theme inheritance behavior should cause a crash?  I sure there's other themes which inherit from each other like this, or do the lines of inheritance never cross?  I bet theme developers inherit from each other recursively; it's too hard to track with so many themes out there. 

 I still find it strange that navigating to Appearance>Cursors would crash System Settings when this particular icon set "Surfn" doesn't contain any cursors, so I don't understand why System Settings crashes when entering kcm_cursortheme. 

Using System Settings, Appearance>Icons to select any Surfn or Sardi icon set variations worked even without this "index.theme" fix because this type of inheritance can be handled without entering an infinite loop.   It worked perfectly fine as an icon theme.  

Anyway, thanks for your help.  I managed to get it working again.  However, I'm not sure if this issue is fully resolved.
Comment 12 Nate Graham 2022-02-04 00:28:48 UTC
Very interesting!

We should be more resilient against bad data here IMO.
Comment 13 David Edmundson 2022-07-10 22:31:56 UTC
>XcursorScanTheme

is outside our stack.

Interestingly our code does have infinite recursion protection. But only for our own usage. Then we add it anyway and let Xcursor parse the data