Bug 444591

Summary: KGet crashes when attempting to download anything
Product: [Applications] kget Reporter: Kārlis Kavacis <karlis.kavacis>
Component: generalAssignee: KGet authors <kget>
Status: RESOLVED FIXED    
Severity: crash CC: fkrueger, george.stefanakis, karlis.kavacis, lassi.vaatamoinen, pokingvictim, wbauer1
Priority: NOR Keywords: drkonqi
Version: 21.08.2   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 21.12.1
Sentry Crash Report:
Attachments: Backtrace_kget_21.08.2_20211104
New crash information added by DrKonqi
Backtrace KGet 21.08.3 Crash
New crash information added by DrKonqi

Description Kārlis Kavacis 2021-10-29 08:26:57 UTC
Application: kget (21.08.2)

Qt Version: 5.15.2
Frameworks Version: 5.87.0
Operating System: Linux 5.14.13-200.fc34.x86_64 x86_64
Windowing System: X11
Distribution: Fedora 34 (KDE Plasma)
DrKonqi: 5.23.1 [KCrashBackend]

-- Information about the crash:
- What I was doing when the application crashed:
Was trying to download Windows 10 install ISO from: https://mpnbenefitscbdsrtl.microsoft.com/db/SW_DVD9_Win_10_21H1_64BIT_Eng_Intl_Home_Pro_SL_S_N_OEM_X22-53937.ISO?t=XXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXXXX&e=XXXXXXXXXXXXXX&h=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(Any potentially sensitive authentication tokens or identifiers redacted from the actual URL)

Opening KGet actually launched this time (sometimes it launches, sometimes it doesn't), trying to start KGet via terminal by supplying it with the URL (kget "DOWNLOAD-URL-HERE") also starts the program but it crashes just as the download starts. For a brief flash before it crashes I was able to see the download status as "Stalled".

Looking through the possibly duplicate Bug reports I did not see any simillar reports based on the described situation when the crash occured in those reports.

The crash can be reproduced every time.

-- Backtrace:
Application: KGet (kget), signal: Segmentation fault

[KCrash Handler]
#4  0x00007ff1b4f155b4 in KMountPoint::mountType() const () from /lib64/libKF5KIOCore.so.5
#5  0x00007ff1b560b08f in DataSourceFactory::start() () from /lib64/libkgetcore.so.5
#6  0x00007ff1b37d83a9 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#7  0x00007ff1b55dd6f4 in TransferDataSource::foundFileSize(TransferDataSource*, unsigned long long, QPair<int, int> const&) () from /lib64/libkgetcore.so.5
#8  0x00007ff1a0035231 in MultiSegKioDataSource::slotTotalSize(unsigned long long, QPair<int, int> const&) () from /usr/lib64/qt5/plugins/kget/kget_multisegkiofactory.so
#9  0x00007ff1b37d83f0 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#10 0x00007ff1a00322af in Segment::slotTotalSize(KJob*, unsigned long long) () from /usr/lib64/qt5/plugins/kget/kget_multisegkiofactory.so
#11 0x00007ff1b37d83a9 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#12 0x00007ff1b48bc342 in KJob::totalSize(KJob*, unsigned long long) () from /lib64/libKF5CoreAddons.so.5
#13 0x00007ff1b48c012a in KJob::setTotalAmount(KJob::Unit, unsigned long long) () from /lib64/libKF5CoreAddons.so.5
#14 0x00007ff1b37d83a9 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#15 0x00007ff1b4ed0586 in KIO::SlaveInterface::totalSize(unsigned long long) () from /lib64/libKF5KIOCore.so.5
#16 0x00007ff1b4ed6f44 in KIO::SlaveInterface::dispatch(int, QByteArray const&) () from /lib64/libKF5KIOCore.so.5
#17 0x00007ff1b4ed007d in KIO::SlaveInterface::dispatch() () from /lib64/libKF5KIOCore.so.5
#18 0x00007ff1b4ed3bb2 in KIO::Slave::gotInput() () from /lib64/libKF5KIOCore.so.5
#19 0x00007ff1b37d83a9 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#20 0x00007ff1b37cef09 in QObject::event(QEvent*) () from /lib64/libQt5Core.so.5
#21 0x00007ff1b4276443 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#22 0x00007ff1b37a4798 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#23 0x00007ff1b37a7d06 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib64/libQt5Core.so.5
#24 0x00007ff1b37f60d7 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5Core.so.5
#25 0x00007ff1b11ca4cf in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#26 0x00007ff1b121e4f8 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0
#27 0x00007ff1b11c7c03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#28 0x00007ff1b37f5b78 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#29 0x00007ff1b37a31a2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#30 0x00007ff1b37ab6e4 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#31 0x000055824bfceddb in main ()
[Inferior 1 (process 9574) detached]

Possible duplicates by query: bug 442461, bug 430007, bug 429430, bug 421299, bug 401799.

Reported using DrKonqi
Comment 1 Kārlis Kavacis 2021-10-29 08:32:15 UTC
Clarification - KGet is not installed from stock Fedora repositories but from Copr, it can be considered as "KDE Platform Compiled from sources".

Name         : kget
Version      : 21.08.2
Release      : 1.fc34
Architecture : x86_64
Size         : 8.9 M
Source       : kget-21.08.2-1.fc34.src.rpm
Repository   : @System
From repo    : copr:copr.fedorainfracloud.org:zawertun:kde
Summary      : Download manager
URL          : https://cgit.kde.org/kget.git
License      : GPLv2+ and GFDL
Description  : Download manager.
Comment 2 Frank Kruger 2021-11-04 08:54:36 UTC
Created attachment 143189 [details]
Backtrace_kget_21.08.2_20211104

Given openSUSE Tumbleweeed 20211102 with 

KDE Plasma Version: 5.23.2
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2

and kget-21.08.2-1.1.x86_64 I am also experiencing kget crashing, even if I just start the application. Backtrace enclosed.
Comment 3 Wolfgang Bauer 2021-12-09 16:46:13 UTC
Hm. kget 21.08.3 doesn't crash here.
Is it still happening?

The crash apparently was in kio, actually.
Maybe it got fixed there already?
Comment 4 Kārlis Kavacis 2021-12-09 18:50:16 UTC
Created attachment 144403 [details]
New crash information added by DrKonqi

kget (21.08.3) using Qt 5.15.2

Just tried to repeat the download to see if the problem still persists and it happened again. I'm suspecting something funky with the download URL or something at fault at server end causing KGet to crash.

Additional info/context in case anything is missing in any of the reports attached:

Fedora release 35 (Thirty Five)

VERSION="35 (KDE Plasma)"
Kernel="5.15.6-200.fc35.x86_64"
KDEPlasmaVersion="5.23.4"
KDEFrameworksVersion="5.88.0"
KDE install source: https://copr.fedorainfracloud.org/coprs/zawertun/kde/

-- Backtrace (Reduced):
#6  QString::QString (other=..., this=<optimized out>, this=<optimized out>, other=...) at /usr/include/qt5/QtCore/qstring.h:1093
#7  KMountPoint::mountType (this=0x0) at /usr/src/debug/kf5-kio-5.88.0-1.fc35.x86_64/src/core/kmountpoint.cpp:412
#8  0x00007fed7435b08f in DataSourceFactory::start() () from /lib64/libkgetcore.so.5
#9  0x00007fed7253f3e9 in QtPrivate::QSlotObjectBase::call (a=0x7ffce6acb9e0, r=<optimized out>, this=0x558d9f1f80e0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#10 doActivate<false> (sender=0x558d9f1d0e20, signal_index=3, argv=0x7ffce6acb9e0) at kernel/qobject.cpp:3886
Comment 5 Kārlis Kavacis 2021-12-09 18:51:47 UTC
Yeah! It's something to do with the download URL or server responses - Fedora Workstation 35 ISO from Fedora home page downloads successfully without crashing KGet!
Comment 6 Kārlis Kavacis 2021-12-09 18:54:29 UTC
Installed Packages
Name         : kget
Version      : 21.08.3
Release      : 1.fc35
Architecture : x86_64
Size         : 8.9 M
Source       : kget-21.08.3-1.fc35.src.rpm
Repository   : @System
From repo    : copr:copr.fedorainfracloud.org:zawertun:kde
Summary      : Download manager
URL          : https://cgit.kde.org/kget.git
License      : GPLv2+ and GFDL
Description  : Download manager.
Comment 7 Wolfgang Bauer 2021-12-09 19:34:42 UTC
(In reply to Kārlis Kavacis from comment #5)
> Yeah! It's something to do with the download URL or server responses -
> Fedora Workstation 35 ISO from Fedora home page downloads successfully
> without crashing KGet!

Would it be possible to share a particular URL that crashes kget?

If I can reproduce the crash, it might help to debug this problem. ;-)
Comment 8 Wolfgang Bauer 2021-12-09 19:38:40 UTC
(In reply to Wolfgang Bauer from comment #7)
> (In reply to Kārlis Kavacis from comment #5)
> > Yeah! It's something to do with the download URL or server responses -
> > Fedora Workstation 35 ISO from Fedora home page downloads successfully
> > without crashing KGet!
> 
> Would it be possible to share a particular URL that crashes kget?
> 
> If I can reproduce the crash, it might help to debug this problem. ;-)

Although, your latest crash seems to be a different one.
So my question in comment#3 still stands.
@Frank Kruger: what's your experience meanwhile?
Comment 9 Frank Kruger 2021-12-09 19:41:03 UTC
(In reply to Wolfgang Bauer from comment #3)
> Hm. kget 21.08.3 doesn't crash here.
> Is it still happening?
> 
> The crash apparently was in kio, actually.
> Maybe it got fixed there already?

Kget 21.08.3 still crashes  at start up with up-to-date openSUSE Tumbleweed 20211207.  Shall I open a bug report there?
Comment 10 Wolfgang Bauer 2021-12-09 19:43:00 UTC
(In reply to Wolfgang Bauer from comment #8)
> (In reply to Wolfgang Bauer from comment #7)
> > (In reply to Kārlis Kavacis from comment #5)
> > > Yeah! It's something to do with the download URL or server responses -
> > > Fedora Workstation 35 ISO from Fedora home page downloads successfully
> > > without crashing KGet!
> > 
> > Would it be possible to share a particular URL that crashes kget?
> > 
> > If I can reproduce the crash, it might help to debug this problem. ;-)
> 
> Although, your latest crash seems to be a different one.
Sorry, I didn't look well enough,
It's actually still in kio too.
> #7  KMountPoint::mountType (this=0x0) at /usr/src/debug/kf5-kio-5.88.0-1.fc35.x86_64/src/core/kmountpoint.cpp:412
> #8  0x00007fed7435b08f in DataSourceFactory::start() () from /lib64/libkgetcore.so.5
Comment 11 Wolfgang Bauer 2021-12-09 19:45:18 UTC
(In reply to Frank Kruger from comment #9)
> (In reply to Wolfgang Bauer from comment #3)
> > Hm. kget 21.08.3 doesn't crash here.
> > Is it still happening?
> > 
> > The crash apparently was in kio, actually.
> > Maybe it got fixed there already?
> 
> Kget 21.08.3 still crashes  at start up with up-to-date openSUSE Tumbleweed
> 20211207.  Shall I open a bug report there?

No. It's likely not a distribution problem, especially as it originally was reported from a Fedora user.
The main question is, what triggers the crash?
Comment 12 Frank Kruger 2021-12-09 19:49:34 UTC
(In reply to Wolfgang Bauer from comment #11)
> (In reply to Frank Kruger from comment #9)
> > (In reply to Wolfgang Bauer from comment #3)
> > > Hm. kget 21.08.3 doesn't crash here.
> > > Is it still happening?
> > > 
> > > The crash apparently was in kio, actually.
> > > Maybe it got fixed there already?
> > 
> > Kget 21.08.3 still crashes  at start up with up-to-date openSUSE Tumbleweed
> > 20211207.  Shall I open a bug report there?
> 
> No. It's likely not a distribution problem, especially as it originally was
> reported from a Fedora user.
> The main question is, what triggers the crash?

Start kget from the console I get:

Verifying Metalink/HTTP Status
Mime Type:  "application/metalink4+xml"
No Metalink HTTP response found
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
KCrash: Application 'kget' crashing...
QSocketNotifier: Invalid socket 8 and type 'Read', disabling...
QSocketNotifier: Invalid socket 13 and type 'Read', disabling...
QSocketNotifier: Invalid socket 25 and type 'Read', disabling...
QSocketNotifier: Invalid socket 23 and type 'Read', disabling...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi
Comment 13 Wolfgang Bauer 2021-12-09 19:51:50 UTC
(In reply to Wolfgang Bauer from comment #11)
> (In reply to Frank Kruger from comment #9)
> > (In reply to Wolfgang Bauer from comment #3)
> The main question is, what triggers the crash?

My only guess so far is that it has to do with what filesystems are mounted.
As the crash reports are all in KMountPoint::mountType()  from kio.

But comment#5 suggests it depends on the URL...

@Frank Kruger:
Does it help if you rename the directory "~/.local/share/kget/", so that current downloads are no longer continued?
Comment 14 Frank Kruger 2021-12-09 19:55:41 UTC
(In reply to Wolfgang Bauer from comment #13)
> (In reply to Wolfgang Bauer from comment #11)
> > (In reply to Frank Kruger from comment #9)
> > > (In reply to Wolfgang Bauer from comment #3)
> > The main question is, what triggers the crash?
> 
> My only guess so far is that it has to do with what filesystems are mounted.
> As the crash reports are all in KMountPoint::mountType()  from kio.
> 
> But comment#5 suggests it depends on the URL...
> 
> @Frank Kruger:
> Does it help if you rename the directory "~/.local/share/kget/", so that
> current downloads are no longer continued?

Yep, it solves it, kget starts and downloads as expected, without any crash. Thx.
Comment 15 Wolfgang Bauer 2021-12-09 20:01:24 UTC
(In reply to Frank Kruger from comment #14)
> Yep, it solves it, kget starts and downloads as expected, without any crash.
> Thx.
Good.

Could you maybe share the files in the old directory?
If you consider them private, maybe we can arrange some way outside this bugzilla...
Comment 16 Wolfgang Bauer 2021-12-09 20:10:24 UTC
(In reply to Wolfgang Bauer from comment #15)
> If you consider them private, maybe we can arrange some way outside this
> bugzilla...

That also applies to Kārlis Kavacis of course.

In the end, I only want to have an URL with which I can reproduce the crash.
Comment 17 Wolfgang Bauer 2021-12-09 20:23:05 UTC
PS: @Kārlis Kavacis
The link in comment#0 unfortunately was obfuscated (by bugzilla I guess), so maybe you could send it to me in private?
Thanks.
Comment 18 Frank Kruger 2021-12-09 20:41:43 UTC
Just tried to download current openSUSE Tumbleweed  ISO via https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Current.iso.meta4 and it crashes again.
Comment 19 Frank Kruger 2021-12-09 21:41:27 UTC
Created attachment 144409 [details]
Backtrace KGet 21.08.3 Crash

(In reply to Frank Kruger from comment #18)
> Just tried to download current openSUSE Tumbleweed  ISO via
> https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-
> Current.iso.meta4 and it crashes again.

Corresponding crash report attached.
Comment 20 Wolfgang Bauer 2021-12-10 10:52:15 UTC
(In reply to Frank Kruger from comment #18)
> Just tried to download current openSUSE Tumbleweed  ISO via
> https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-
> Current.iso.meta4 and it crashes again.

Thanks, I can reproduce the crash now.

I'll investigate and will try to fix it...
Comment 21 Wolfgang Bauer 2021-12-21 10:09:04 UTC
*** Bug 447149 has been marked as a duplicate of this bug. ***
Comment 22 george.stefanakis 2021-12-21 22:24:44 UTC
Created attachment 144767 [details]
New crash information added by DrKonqi

kget (21.12.0) using Qt 5.15.3

- What I was doing when the application crashed:
Just trying to download an ISO file.  I had just copied the link, paste it to New Download, in Kget.  Kget insert the link and tried to download the file, and then crashed.  I have tried it 4 times with the same result.

-- Backtrace (Reduced):
#4  0x00007f79c6a5bcc4 in KMountPoint::mountType() const () from /lib/x86_64-linux-gnu/libKF5KIOCore.so.5
#5  0x00007f79c721a759 in DataSourceFactory::start (this=0x7f79b8007b70) at ./core/datasourcefactory.cpp:277
#6  0x00007f79c721ad78 in DataSourceFactory::slotFoundFileSize (this=0x7f79b8007b70, source=<optimized out>, fileSize=<optimized out>, segmentRange=...) at ./core/datasourcefactory.cpp:151
#7  0x00007f79c51abdce in QtPrivate::QSlotObjectBase::call (a=0x7ffe909458f0, r=0x7f79b8007b70, this=0x55c82a62b2b0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#8  doActivate<false> (sender=0x55c82a6699e0, signal_index=3, argv=0x7ffe909458f0) at kernel/qobject.cpp:3886
Comment 23 Wolfgang Bauer 2022-01-03 19:32:49 UTC
Git commit 13187db5a4288ad5e852c851eec16ea6e0a8ccd2 by Wolfgang Bauer.
Committed on 03/01/2022 at 19:22.
Pushed by wbauer into branch 'release/21.12'.

Fix destination filesystem type check for downloads bigger than 4 GiB

`m_dest` is a QUrl, we need to use `toLocalFile()` to get a local path.
`toString()` results in a URL instead ("file://...") which causes the
mountpoint lookup to fail.

Also, the check whether the mountpoint was found was reversed. It
actually tried to compare the filesystem type when the mount point was
*not* found, resulting in a crash because of the nullptr dereference.
FIXED-IN: 21.12.1

M  +3    -3    core/datasourcefactory.cpp

https://invent.kde.org/network/kget/commit/13187db5a4288ad5e852c851eec16ea6e0a8ccd2
Comment 24 Frank Kruger 2022-01-08 08:40:19 UTC
(In reply to Wolfgang Bauer from comment #23)
> Git commit 13187db5a4288ad5e852c851eec16ea6e0a8ccd2 by Wolfgang Bauer.
> Committed on 03/01/2022 at 19:22.
> Pushed by wbauer into branch 'release/21.12'.
> 
> Fix destination filesystem type check for downloads bigger than 4 GiB
> 
> `m_dest` is a QUrl, we need to use `toLocalFile()` to get a local path.
> `toString()` results in a URL instead ("file://...") which causes the
> mountpoint lookup to fail.
> 
> Also, the check whether the mountpoint was found was reversed. It
> actually tried to compare the filesystem type when the mount point was
> *not* found, resulting in a crash because of the nullptr dereference.
> FIXED-IN: 21.12.1
> 
> M  +3    -3    core/datasourcefactory.cpp
> 
> https://invent.kde.org/network/kget/commit/
> 13187db5a4288ad5e852c851eec16ea6e0a8ccd2

kget 21.12.1 works fine here (openSUSE Tumbleweed 20220106). Thx.
Comment 25 Wolfgang Bauer 2022-01-11 20:23:57 UTC
*** Bug 448276 has been marked as a duplicate of this bug. ***