qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.25k stars 3.97k forks source link

Launch fails on KDE Plasma 6.0 when "Window state on start up" is set to "Hidden" #20516

Closed cdf144 closed 7 months ago

cdf144 commented 8 months ago

qBittorrent & operating system versions

qBittorrent: 4.6.3 x64 Operating system: Arch Linux Qt: 6.6.2 libtorrent-rasterbar: 2.0.9.0

What is the problem?

Similar behavior to #20511 but I've been narrowing it down to the "Window state on start up" settings.

Steps to reproduce

  1. Change the setting either via qBittorrent GUI or set the value in qbittorrent.conf:
[GUI]
StartUpWindowState=Hidden
  1. Close qBittorrent if it is open and launch it again
  2. qBittorrent tray icon flashes then disappear, qBittorrent process itself stops with no crash; if ran through the command line, it exits normally (exit code 0) with no logs.

Additional context

No response

Log(s) & preferences file(s)

Possibly related journalctl entries:

Mar 07 20:09:48 systemd[852]: Started qBittorrent - BitTorrent client.
Mar 07 20:09:49 kded6[1093]: Registering ":1.401/StatusNotifierItem" to system tray
Mar 07 20:09:49 kded6[1093]: Service  ":1.401" unregistered
Mar 07 20:09:49 kded6[1093]: Registering ":1.402/StatusNotifierItem" to system tray
Mar 07 20:09:51 qbittorrent[29599]: QFSFileEngine::open: No file name specified
Mar 07 20:09:51 qbittorrent[29599]: QFSFileEngine::open: No file name specified

As stated above, unfortunately no logs when launching on command line, and no relevant info on qBittorrent.log either.

MorsMortium commented 8 months ago

Valgrind said this about it, if it helps:

==24779== Memcheck, a memory error detector
==24779== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==24779== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==24779== Command: qbittorrent
==24779== 
==24779== Conditional jump or move depends on uninitialised value(s)
==24779==    at 0xEDA7AC9: ???
==24779==    by 0x1AF73F5F: ???
==24779== 
==24779== Conditional jump or move depends on uninitialised value(s)
==24779==    at 0xEDA7AC9: ???
==24779==    by 0x1AF7CC0F: ???
==24779== 
==24779== Conditional jump or move depends on uninitialised value(s)
==24779==    at 0xEDA7AC9: ???
==24779==    by 0x1AF7CF5F: ???
==24779== 
==24779== Conditional jump or move depends on uninitialised value(s)
==24779==    at 0xEDA7AC9: ???
==24779==    by 0x1AF7D94F: ???
==24779== 
==24779== Syscall param waitid(infop) points to unaddressable byte(s)
==24779==    at 0x6E7C88D: syscall (syscall.S:38)
==24779==    by 0x6715407: ??? (in /usr/lib/libQt6Core.so.6.6.2)
==24779==    by 0x5F3A95: ??? (in /usr/bin/qbittorrent)
==24779==    by 0x42099A: Utils::ForeignApps::pythonInfo() (in /usr/bin/qbittorrent)
==24779==    by 0x48C208: MainWindow::on_actionSearchWidget_triggered() (in /usr/bin/qbittorrent)
==24779==    by 0x6592076: QObject::event(QEvent*) (in /usr/lib/libQt6Core.so.6.6.2)
==24779==    by 0x49973AA: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt6Widgets.so.6.6.2)
==24779==    by 0x65509C7: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt6Core.so.6.6.2)
==24779==    by 0x6550D4A: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt6Core.so.6.6.2)
==24779==    by 0x67890D3: ??? (in /usr/lib/libQt6Core.so.6.6.2)
==24779==    by 0x7157F68: ??? (in /usr/lib/libglib-2.0.so.0.7800.4)
==24779==    by 0x71B63A6: ??? (in /usr/lib/libglib-2.0.so.0.7800.4)
==24779==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==24779== 
==24779== 
==24779== HEAP SUMMARY:
==24779==     in use at exit: 404,832 bytes in 2,882 blocks
==24779==   total heap usage: 315,415 allocs, 312,533 frees, 109,447,710 bytes allocated
==24779== 
==24779== LEAK SUMMARY:
==24779==    definitely lost: 4,536 bytes in 23 blocks
==24779==    indirectly lost: 7,316 bytes in 58 blocks
==24779==      possibly lost: 0 bytes in 0 blocks
==24779==    still reachable: 390,964 bytes in 2,780 blocks
==24779==                       of which reachable via heuristic:
==24779==                         newarray           : 4,264 bytes in 1 blocks
==24779==         suppressed: 0 bytes in 0 blocks
==24779== Rerun with --leak-check=full to see details of leaked memory
==24779== 
==24779== Use --track-origins=yes to see where uninitialised values come from
==24779== For lists of detected and suppressed errors, rerun with: -s
==24779== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
glassez commented 8 months ago

I just tested the official AppImage build on the newly installed KDE Neon, and I did not encounter such a problem. Maybe the Arch distro maintainers forgot to rebuild qBittorrent with updated dependencies again?

MadeOfMagicAndWires commented 8 months ago

I just tested the official AppImage build on the newly installed KDE Neon, and I did not encounter such a problem. Maybe the Arch distro maintainers forgot to rebuild qBittorrent with updated dependencies again?

After encountering the same issue I rebuilt the Arch package from source and the problem persisted, so if it's the Arch package it's not that they forgot to rebuild it. A different solution than setting start up option to anything other than Hidden was specifying the QT_QPA_PLATFORMTHEME variable to qt6ct or gtk{2,3}, so it definitely seems theme-related.

v-fox commented 8 months ago

I just tested the official AppImage build on the newly installed KDE Neon, and I did not encounter such a problem. Maybe the Arch distro maintainers forgot to rebuild qBittorrent with updated dependencies again?

I've built my custom qB package (I even made it 'Debug' type with '-O3' so terminal logging would not be disabled) with your icon patch for openSUSE Tumbleweed against current state of repositories but that did not help. Only setting QT_QPA_PLATFORMTHEME helped. Seems like another case of an app really hating something in a setting of a new KDE theme. The worst part is that it refuses to say what, silently going into quitting without crash or spewing anything into a log.

glassez commented 7 months ago

Strangely, my custom build (of qBittorrent master) works fine on KDE Neon with "Hidden" startup state. It does not have the QT_QPA_PLATFORMTHEME variable set. What value QT_QPA_PLATFORMTHEME has by default in your distro?

v-fox commented 7 months ago

Strangely, my custom build (of qBittorrent master) works fine on KDE Neon with "Hidden" startup state. It does not have the QT_QPA_PLATFORMTHEME variable set. What value QT_QPA_PLATFORMTHEME has by default in your distro?

Is not set for me either. What about current release? Seems like master is very different from pre-release branch too. Maybe something was fixed in branches?

glassez commented 7 months ago

What about current release? Seems like master is very different from pre-release branch too. Maybe something was fixed in branches?

I don't recall that we touched on related aspects. However, I still rebuilt qBittorrent from v4_6_x branch and it also works fine for me. So the problem seems to be somewhere in the environment in which you are running qBittorrent. Honestly, I have little desire to install Arch and set up appropriate development environment to test it there.

v-fox commented 7 months ago

Honestly, I have little desire to install Arch and set up appropriate development environment to test it there.

Well, neither do I as I use openSUSE and not Arch. If anything, you should be more worried about 1) the fact that it auto-exits without error or log; 2) that users can't get a pip from it in terminal unless recompiled with 'Debug'. Someone had to code such wrong behaviour somewhere for it to trip and not crash fully. Otherwise at least we could have easily got trace pointing at the source of the problem.

I wouldn't be surprised if this has something to do with "Application Style" & "Window Decorations" selected, which are "Breeze" & "Oxygen" for me. I vaguely remember some app weirdly losing its shit with Oxygen years ago.

glassez commented 7 months ago

the fact that it auto-exits without error or log

BTW, no one provided qBittorrent logs. Maybe qBittorrent just "thinks" it is shutting down normally? For example, it receives a signal from the window system or something similar.

glassez commented 7 months ago

that users can't get a pip from it in terminal unless recompiled with 'Debug'. Someone had to code such wrong behaviour somewhere for it to trip and not crash fully. Otherwise at least we could have easily got trace pointing at the source of the problem.

Unfortunately, most Linux distributions do not comply with the predefined qBittorrent compilation flags, so the built-in "stack trace" feature turns out to be inoperable.

MorsMortium commented 7 months ago

the fact that it auto-exits without error or log

BTW, no one provided qBittorrent logs. Maybe qBittorrent just "thinks" it is shutting down normally? For example, it receives a signal from the window system or something similar.

(N) 2024-03-15T18:48:53 - qBittorrent v4.6.3 started
(N) 2024-03-15T18:48:53 - Using config directory: /home/morsmortium/.config/qBittorrent
(N) 2024-03-15T18:48:53 - Trying to listen on the following list of IP addresses: 
(I) 2024-03-15T18:48:53 - Peer ID: ""
(I) 2024-03-15T18:48:53 - HTTP User-Agent: "qBittorrent/4.6.3"
(I) 2024-03-15T18:48:53 - Distributed Hash Table (DHT) support: ON
(I) 2024-03-15T18:48:53 - Local Peer Discovery support: ON
(I) 2024-03-15T18:48:53 - Peer Exchange (PeX) support: ON
(I) 2024-03-15T18:48:53 - Anonymous mode: OFF
(I) 2024-03-15T18:48:53 - Encryption support: ON
(I) 2024-03-15T18:48:53 - UPnP/NAT-PMP support: ON
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(I) 2024-03-15T18:48:53 - Successfully listening on IP. IP: 
(N) 2024-03-15T18:48:53 - Restored torrent. Torrent: 
(N) 2024-03-15T18:48:53 - Restored torrent. Torrent: 
(N) 2024-03-15T18:48:53 - Restored torrent. Torrent: 
(N) 2024-03-15T18:48:53 - Restored torrent. Torrent: 
(N) 2024-03-15T18:48:53 - Restored torrent. Torrent: 
(N) 2024-03-15T18:48:53 - Restored torrent. Torrent: 
(I) 2024-03-15T18:48:53 - IP geolocation database loaded. Type: DBIP-Country-Lite. Build time: Fri Mar 1 02:21:18 2024.
(I) 2024-03-15T18:48:53 - Python detected, executable name: 'python3', version: 3.11.8
(N) 2024-03-15T18:48:53 - qBittorrent termination initiated
(I) 2024-03-15T18:48:53 - Detected external IP. IP: 
(I) 2024-03-15T18:48:53 - Detected external IP. IP: 
(N) 2024-03-15T18:48:56 - qBittorrent is now ready to exit

Seems to be the case. (removed ip and torrent info only)

glassez commented 7 months ago

I wonder how it would behave if you configure startup state "minimized" and "minimize to tray" enabled?

MorsMortium commented 7 months ago

I wonder how it would behave if you configure startup state "minimized" and "minimize to tray" enabled?

It does not exit and stays in the tray.

(N) 2024-03-16T13:19:20 - qBittorrent v4.6.3 started
(N) 2024-03-16T13:19:20 - Using config directory: /home/morsmortium/.config/qBittorrent
(N) 2024-03-16T13:19:20 - Trying to listen on the following list of IP addresses: 
(I) 2024-03-16T13:19:20 - Peer ID: ""
(I) 2024-03-16T13:19:20 - HTTP User-Agent: "qBittorrent/4.6.3"
(I) 2024-03-16T13:19:20 - Distributed Hash Table (DHT) support: ON
(I) 2024-03-16T13:19:20 - Local Peer Discovery support: ON
(I) 2024-03-16T13:19:20 - Peer Exchange (PeX) support: ON
(I) 2024-03-16T13:19:20 - Anonymous mode: OFF
(I) 2024-03-16T13:19:20 - Encryption support: ON
(I) 2024-03-16T13:19:20 - UPnP/NAT-PMP support: ON
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(I) 2024-03-16T13:19:20 - Successfully listening on IP. IP: 
(N) 2024-03-16T13:19:20 - Restored torrent. Torrent: 
(N) 2024-03-16T13:19:20 - Restored torrent. Torrent: 
(N) 2024-03-16T13:19:20 - Restored torrent. Torrent: 
(N) 2024-03-16T13:19:20 - Restored torrent. Torrent: 
(N) 2024-03-16T13:19:20 - Restored torrent. Torrent: 
(N) 2024-03-16T13:19:20 - Restored torrent. Torrent: 
(I) 2024-03-16T13:19:20 - IP geolocation database loaded. Type: DBIP-Country-Lite. Build time: Fri Mar 1 02:21:18 2024.
(I) 2024-03-16T13:19:20 - Detected external IP. IP: 
(I) 2024-03-16T13:19:20 - Python detected, executable name: 'python3', version: 3.11.8
(I) 2024-03-16T13:19:20 - Detected external IP. IP: 
glassez commented 7 months ago

I wonder how it would behave if you configure startup state "minimized" and "minimize to tray" enabled?

It does not exit and stays in the tray

Well, at least there is something to use as a workaround if we do not find the true cause of what is happening.

glassez commented 7 months ago

Strangely, my custom build (of qBittorrent master) works fine on KDE Neon with "Hidden" startup state.

But if I link it with system Qt it closes by itself. This fact led me to the idea of finding the differences between my custom Qt build and the system one. And I was able to identify the culpable component. It turned out to be KDEPlasmaPlatformTheme6.so plugin, which is provided by the plasma-integration package.

redeven commented 6 months ago

Issue continues to occur on qBittorrent 4.6.4, with KDE Plasma 6.0.4. With StartUpWindowState=Hidden, qBittorrent will refuse to start.

$ journalctl -e
...
Apr 21 10:28:56 redeven plasmashell[1153]: file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/ApplicationsPage.qml:202: TypeError: Cannot read property 'forceActiveFocus' of null
Apr 21 10:28:57 redeven systemd[1012]: Started qBittorrent - BitTorrent client.
Apr 21 10:28:57 redeven kded6[1107]: Registering ":1.249/StatusNotifierItem" to system tray
Apr 21 10:28:57 redeven kded6[1107]: Service  ":1.249" unregistered
...
glassez commented 6 months ago

Issue continues to occur on qBittorrent 4.6.4

v4.6.4 isn't supposed to fix it.

redeven commented 6 months ago

Oh I didn't notice the fix came in barely after 4.6.4, so it's pending a future release cycle. Apologies.

ssrublev commented 6 months ago

I confirm this in Fedora 40 Plasma 6.0.4 qBittorrent v4.6.4. QBittorrent won't start with StartUpWindowState=Hidden but if I set StartUpWindowState= then it does start.

glassez commented 6 months ago

I confirm this in Fedora 40 Plasma 6.0.4 qBittorrent v4.6.4. QBittorrent won't start with StartUpWindowState=Hidden but if I set StartUpWindowState= then it does start.

Issue continues to occur on qBittorrent 4.6.4

v4.6.4 isn't supposed to fix it.