Bug 74597 - [PATCH] threading deadlock while starting / finishing transfer
Summary: [PATCH] threading deadlock while starting / finishing transfer
Status: RESOLVED DUPLICATE of bug 75429
Alias: None
Product: kget
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KGet authors
URL:
Keywords:
: 75737 75944 76772 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-08 18:06 UTC by Thomas Zell
Modified: 2004-05-10 20:23 UTC (History)
9 users (show)

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


Attachments
remove threading (9.06 KB, patch)
2004-02-08 18:08 UTC, Thomas Zell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Zell 2004-02-08 18:06:57 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    SuSE RPMs
Compiler:          gcc 3.3.1 
OS:          Linux

Using the latest KDE and QT RPM packages from ftp.suse.com the "Slave" thread reproducably locks up when either starting or finishing the second transfer since kget has been started.

In the first case only the "Slave" never wakes up from
- worker.wait(); (line number 108 of slave.cpp)
in the second case the whole application hangs at
- m_pSlave->wait(); (line number 168 of transfer.cpp)

If the second transfer already hangs at the beginning, all subsequent transfers also hang. KGet locks up completely if one tries to quit it.

This is by no means meant offensively ... but I really wonder why KGet needs more than one thread if KIO::GetFileJob already does all the work asynchronously. I was able to solve the problem by removing multi-threading from KGet (see attached diff).  The GUI is exactly as responsive as before. Be warned, though: Although it does work for me, I might have overlooked some things ...

Well, maybe it's just a bug in Qt or some other library and it isn't even KGet's fault ... however, I still think it's alot cleaner to remove the unneeded threading :)
Comment 1 Thomas Zell 2004-02-08 18:08:04 UTC
Created attachment 4579 [details]
remove threading
Comment 2 Rex Dieter 2004-03-01 16:54:34 UTC
*** Bug 75944 has been marked as a duplicate of this bug. ***
Comment 3 i.linty 2004-03-02 09:48:18 UTC
Please see also my patch that doesn't remove threading support, but fix it !
See bug 75737 attachment 4954 [details].
Bye
Comment 4 Christoph Bartoschek 2004-03-02 11:17:29 UTC
I can confirm that the patch by i.linty@regione.vda.it as well as my patch at attachement 4860 solve this issue for me. I would combine both patches, but there is still some work left, if you want to keep the threaded version: 

1. Is a stack really better than a queue for class slave?

2. One should never call QThread::terminate(). A term command is the correct way to tell class slave to come to an end. Then one has to two options. On the one hand one can wait with QThread::wait() or on the other hand one sets the slave thread to the detached state and forgets it, which is not so easy with Qt as far as I know.
Comment 5 Rex Dieter 2004-03-10 17:22:07 UTC
*** Bug 76772 has been marked as a duplicate of this bug. ***
Comment 6 Rex Dieter 2004-03-10 17:22:22 UTC
*** Bug 75737 has been marked as a duplicate of this bug. ***
Comment 7 Damir Perisa 2004-03-25 16:29:28 UTC
confirm this bug using kde 3.2.1 release
Comment 8 Daniel Rendall 2004-03-26 17:37:37 UTC
I can confirm that KGet in 3.2.1 (installed via Gentoo ebuild, with kernel version 2.6.3) does tend to hang frequently and it seems to be when I try to download more than one file (i.e. on the second transfer).

Also, the patch contributed by i.linty@regione.vda.it (attachment 4954 [details]) fixed the same problem in the 3.2.0 release. After I patched it, KGet worked fine until I upgraded to 3.2.1 and now the problem is back.
Comment 9 Alex Kern 2004-03-26 23:22:18 UTC
Hi, can you verify this behaviour with version CVS. I have committed minimal change two weeks ago. Unfortunately it was to late for 3.2.1. I would too prefer to remove threading from kget, as it is overengineered in my mind.
  
Comment 10 Daniel Rendall 2004-04-11 18:34:14 UTC
Sorry about the delay in replying.
I've just checked out kdenetwork from CVS and built kget, and can confirm that it seems to be working correctly. At least, I've downloaded several things with it and it hasn't hung like it did previously.
Comment 11 Andrew Somerville 2004-04-14 04:26:14 UTC
I can't tell you how sick of this bug I am. Glad to see that someone has a patch for it, even though it prevents threading. 
Comment 12 Stephan Kulow 2004-05-10 20:23:52 UTC

*** This bug has been marked as a duplicate of 75429 ***