Bug 504487 - [ANR] Closing the "Keyboard Shortcuts" window whilst it is waiting for the "Print" window to appear causes a crash.
Summary: [ANR] Closing the "Keyboard Shortcuts" window whilst it is waiting for the "P...
Status: RESOLVED UPSTREAM
Alias: None
Product: kde
Classification: I don't know
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Unassigned bugs
URL:
Keywords: drkonqi
: 504488 504489 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-05-18 19:13 UTC by Roke Julian Lockhart Beedell
Modified: 2025-05-23 20:30 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report: https://crash-reports.kde.org/organizations/kde/issues/183325/events/38c4f63efea442a19fb00fce5c316813/


Attachments
New crash information added by DrKonqi (72.92 KB, text/plain)
2025-05-18 19:13 UTC, Roke Julian Lockhart Beedell
Details
A Screenshot Of The Affected Button In The Affected Modal Window (18.96 KB, image/png)
2025-05-18 20:37 UTC, Roke Julian Lockhart Beedell
Details
A Reproduction Screencast (In KHelpCenter) (662.53 KB, video/webm)
2025-05-18 20:41 UTC, Roke Julian Lockhart Beedell
Details
A KCrash Of Krita, For Comment 11 (15.93 KB, text/vnd.kde.kcrash-report)
2025-05-22 19:31 UTC, Roke Julian Lockhart Beedell
Details
A Screencast Of STrace Attached To KWrite, For Comment 11 (3.26 MB, video/webm)
2025-05-22 19:38 UTC, Roke Julian Lockhart Beedell
Details
A KWrite Perf Record, For Comment 11 (464.51 KB, application/x-7z-compressed)
2025-05-22 19:38 UTC, Roke Julian Lockhart Beedell
Details
A KWrite STrace Record, For Comment 11 (800.14 KB, text/markdown)
2025-05-22 19:40 UTC, Roke Julian Lockhart Beedell
Details
A Screencast Demonstrating That This Affects All Qt 6 Applications (2.81 MB, video/webm)
2025-05-23 20:30 UTC, Roke Julian Lockhart Beedell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roke Julian Lockhart Beedell 2025-05-18 19:13:30 UTC
Application: dolphin (25.04.1)

ApplicationNotResponding [ANR]: true
Qt Version: 6.9.0
Frameworks Version: 6.14.0
Operating System: Linux 6.14.6-300.fc42.x86_64 x86_64
Windowing System: Wayland
Distribution: "Fedora Linux 42 (KDE Plasma Desktop Edition)"
DrKonqi: 6.3.5 [CoredumpBackend]

-- Information about the crash:
Accessing the "Keyboard Shortcuts" > "Print", then closing the "Keyboard Shortcuts" window because the "Print" window never appears, causes a crash.

The crash can be reproduced every time.

-- Backtrace (Reduced):
#5  __syscall_cancel_arch () at ../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56
#6  0x00007fd25c67b9da in __internal_syscall_cancel (a1=<optimized out>, a2=<optimized out>, a3=a3@entry=50, a4=a4@entry=0, a5=a5@entry=0, a6=a6@entry=0, nr=7) at cancellation.c:49
#7  0x00007fd25c67ba24 in __syscall_cancel (a1=<optimized out>, a2=<optimized out>, a3=a3@entry=50, a4=a4@entry=0, a5=a5@entry=0, a6=a6@entry=0, nr=7) at cancellation.c:75
#8  0x00007fd25c6f4c4e in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=timeout@entry=50) at ../sysdeps/unix/sysv/linux/poll.c:29
#9  0x00007fd1e85e3e3c in poll (__fds=<optimized out>, __nfds=<optimized out>, __timeout=50) at /usr/include/bits/poll2.h:44


Reported using DrKonqi
Comment 1 Roke Julian Lockhart Beedell 2025-05-18 19:13:31 UTC
Created attachment 181472 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 Roke Julian Lockhart Beedell 2025-05-18 19:15:05 UTC
*** Bug 504488 has been marked as a duplicate of this bug. ***
Comment 3 Roke Julian Lockhart Beedell 2025-05-18 19:15:10 UTC
*** Bug 504489 has been marked as a duplicate of this bug. ***
Comment 4 Roke Julian Lockhart Beedell 2025-05-18 20:37:02 UTC
(In reply to Roke Julian Lockhart Beedell from comment #3)

I've reported about 30 instances of this to Sentry across about 30 different applications. However, I can't access Sentry, so can't link them here. Instead, I tried to put a link to this, and useful description, in each report. Otherwise, see https://bugzilla.redhat.com/show_bug.cgi?id=2367102#c0 and its linked reports for FAF data. If you wait > P6M, though, the FAF data shall be gone (although their RHBZ reports shall remain).
Comment 5 Roke Julian Lockhart Beedell 2025-05-18 20:37:57 UTC
Created attachment 181477 [details]
A Screenshot Of The Affected Button In The Affected Modal Window
Comment 6 Roke Julian Lockhart Beedell 2025-05-18 20:41:53 UTC
Created attachment 181478 [details]
A Reproduction Screencast (In KHelpCenter)

(In reply to Roke Julian Lockhart Beedell from comment #4)

Of note is that despite this affecting:

1. KWalletManager

2. Okular

3. KMenuEdit

4. KRFB

5. KRDC

6. Konsole

7. KGPG

8. KDE Partition Manager

9. KCharSelect

10. KAddressBook

11. Gwenview

12. Dolphin

13. DigiKam

14. KDenLive

15. KHelpCenter

This *does not* affect Krita, nor SkanPage, no matter what I try. IDK what differs about them.
Comment 7 Nate Graham 2025-05-19 00:47:53 UTC
For me the Print dialog appears, and while it's open, I can't close the Keyboard Shortcuts window.

It may take a little bit of time for the Print dialog to appear; maybe that's what's happening? If you wait 10 or 15 seconds, does it eventually appear?
Comment 8 Roke Julian Lockhart Beedell 2025-05-19 07:42:25 UTC
(In reply to Nate Graham from comment #7)

> If you wait 10 or 15 seconds, does it eventually appear?

It does, but it takes such an inordinate amount of time that the first few times I hit this, I really was just trying to escape from what looked like a hung window. That's why I reported this – it looks like invoking the print dialog isn't cancellable by its caller, which is a problem when the dialog can't appear, or takes too long (without a loading progress indicator) for it to be useful.

I have no printer connected, so it should be instantaneous. If it's somehow expected to take > 10s on a system with 32 GiB of SDRAM and a ≥ 4 GHz CPU, one would expect there to be a loading indicator. 😅
Comment 9 Nate Graham 2025-05-19 21:10:37 UTC
The fact that the print dialog takes a long time to appear when it shouldn't is probably the real issue to dig into here; if it was fast, you wouldn't try to close its parent window — and in fact could not, because by the time you tried, the print dialog would already be visible.

I'm not sure there's much we can do here though, since the print dialog comes from Qt directly.

CCing a printer-savvy person who may know more.

P.S. why were you trying to open the print dialog if you don't have a printer? To make a PDF?
Comment 10 Mike 2025-05-19 22:00:21 UTC
Nate is correct, this is essentially an "app" using print services provided by Qt.  In my case, I get modal behavior immediately, meaning once the print button is clicked, I can't close the window while waiting for the modal print dialog to present.  Even then, it still acts modal.  And I too, am on Qt6.9.

I'm more familiar with the config/setup side of printer management, not so much print services provided by Qt, but I can tell you this: there is at least one timeout in the code path, maybe two.  It's been a while, but IIRC, Qt is looking for/initializing print services backend (CUPS) and then CUPS is looking/waiting for it's own backends to enumerate.  The latter can take a some seconds I've noticed and it appears to be directly related to not just CUPS backends installed, but also the number of "filters" you have installed, ie. cups-filters, hplip-*, epson, etc...

One thing you could try is to turn off your networking, then try the print and see if the dialog still takes "a while" to present.  CUPS will do some IPP/network "stuff" to discover printers on your net.

In addition, you could disable CUPS `sudo systemctl stop cups.service` and then try the print and see what happens there.  Turn it back on later with systemctl start cups, fyi.

Not sure this helps but it might give some clues on where to dig in first.
Comment 11 Roke Julian Lockhart Beedell 2025-05-22 19:31:17 UTC
Created attachment 181658 [details]
A KCrash Of Krita, For Comment 11

(In reply to Nate Graham from comment #9)

> Why were you trying to open the print dialog if you don't have a printer? To make a PDF?

Yes. I thought it might be a useful way to visualise (or, crudely, backup) keyboard shortcuts.

(In reply to Mike from comment #10)

> there is at least one timeout in the code path, maybe two.

I've captured a Perf and STrace record, if of use. I've plonked them in https://collaborate.kde.org/apps/files/files/684451?dir=/%27Custom%27%23.dir/%27Publicly%20Accessible%27%23.dir/%27bugs.KDE.org%27%23.dir/%27504487%27%23.dir, but shall attach them once I've submitted this comment.

About STrace, I saw, whilst the printer is loading, a multitude of ultimately quite quick calls, repeatedly occurring until the dialog appears:

> 0.000048 read(28, "W", 10)         = 1 <0.000011>  
> 0.000030 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050086>  
> 0.050137 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050083>  
> 0.050127 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050084>  
> 0.050134 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050091>  
> 0.050139 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050088>  
> 0.050154 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050088>  
> 0.050147 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050088>  
> 0.050135 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050088>  
> 0.050134 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050078>  
> 0.050122 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050081>  
> 0.050126 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050080>  
> 0.050126 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050097>  
> 0.050146 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050041>  
> 0.050095 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050088>  
> 0.050139 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050089>  
> 0.050148 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050090>  
> 0.050160 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 0 (Timeout) <0.050088>  
> 0.050151 poll([{fd=28, events=POLLIN}, {fd=30, events=POLLIN}], 2, 50) = 1 ([{fd=30, revents=POLLIN}]) <0.048304>  
> 0.048380 recvmsg(30, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1\0\0\0\0\220\0\0\0\215\0\0\0\1\1o\0\31\0\0\0/Client1"..., iov_len=2048}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 320 <0.000034>

From what I see, this doesn't occur before or after I invoke the dialog.

...About CUPS:

> One thing you could try is to turn off your networking, then try the print and see if the dialog still takes "a while" to present.  CUPS will do some IPP/network "stuff" to discover printers on your net.
> 
> You could disable CUPS `sudo systemctl stop cups.service` and then try the print and see what happens there.

I stopped it, and verified it was:

> Loaded: loaded (/usr/lib/systemd/system/cups.service; disabled; preset: disabled)

This made it almost ⪆ 4s faster, but it still takes ⪅ 2.5s to appear, which is still bad on a system with 32 GiB of DDR5 SDRAM! 😆 However, disabling Ethernet reduced it by *maybe* ⪅ 0.5s, if I'm not merely experiencing confirmation bias / placebo / whatever. I suppose we can consider CUPS the most *significant* culprit, but on Windows, this is instantaneous, so there's more at play.

(In reply to Roke Julian Lockhart Beedell from comment #6)

> This *does not* affect Krita, nor SkanPage

It *does* affect Krita too, per https://discuss.kde.org/t/is-a-kde-application-not-providing-a-bug-reporting-address-a-bug/34640?u=rokejulianlockhart. The reason SkanPage doesn't appear affected appears to be that it solely exposes one keyboard shortcut. At least that demonstrates that the quantity of shortcuts affects invocation time. I'll presume you knew this, though, you backtrace-reading nutters.
Comment 12 Roke Julian Lockhart Beedell 2025-05-22 19:38:12 UTC
Created attachment 181659 [details]
A Screencast Of STrace Attached To KWrite, For Comment 11
Comment 13 Roke Julian Lockhart Beedell 2025-05-22 19:38:59 UTC
Created attachment 181660 [details]
A KWrite Perf Record, For Comment 11
Comment 14 Roke Julian Lockhart Beedell 2025-05-22 19:40:22 UTC
Created attachment 181661 [details]
A KWrite STrace Record, For Comment 11
Comment 15 Roke Julian Lockhart Beedell 2025-05-22 19:59:12 UTC
(In reply to Roke Julian Lockhart Beedell from comment #11)

...Ignore that NextCloud URI. I wrote that comment in a text editor, and meant to leave that as a note to self to remove once I published the comment. Apologies for the noise.
Comment 16 Roke Julian Lockhart Beedell 2025-05-23 20:30:35 UTC
Created attachment 181687 [details]
A Screencast Demonstrating That This Affects All Qt 6 Applications

(In reply to Roke Julian Lockhart Beedell from comment #11)

> I suppose we can consider CUPS the most *significant* culprit, but on Windows, this is instantaneous, so there's more at play.

Per [`bbs.archlinux.org/viewtopic.php?pid=1279792#p1279792`][1], I've ascertained that the cause is `avahi-daemon.service` (or, at least, its default configuration). Consequently, I have filed https://github.com/avahi/avahi/issues/701#issue-3087466051 to, hopefully, replace this. If not, it's at worst a Qt issue, rather than a KDE one, since it affects a custom PyQt6 application of mine, too.

[1]: https://bbs.archlinux.org/viewtopic.php?pid=1279792#p1279792:~:text=but%20after%20I%20setup%20my%20network(with%20help%20of%20a%20question%20created%20by%20me%20on%20unix.stackexchange.com)%20I%20discovered%20that%20problem%20isn't%20cups%20and%20isn't%20network%2C%20the%20problem%20is%20the%20avahi%2Ddaemon%2C%20if%20it's%20runnig%20the%20cups%20is%20slow%2C%20if%20it%20isn't%20cups%20is%20normal...