Bug 288028 - ktorrent crashes at startup with error: 'Signal: Segmentation fault (11)'
Summary: ktorrent crashes at startup with error: 'Signal: Segmentation fault (11)'
Status: RESOLVED WAITINGFORINFO
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 01:54 UTC by Marius Manea
Modified: 2012-03-24 11:45 UTC (History)
3 users (show)

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


Attachments
crash after running overnight (8.64 KB, application/octet-stream)
2011-12-04 15:33 UTC, Marius Manea
Details
crash at startup right after loading the main window (9.80 KB, application/octet-stream)
2011-12-04 15:34 UTC, Marius Manea
Details
Backtrace log obtained with gdb. ktorrent crashed right after startup (23.78 KB, text/x-log)
2011-12-04 21:20 UTC, Marius Manea
Details
ktorrent crash at startup, backtrace (7.32 KB, application/octet-stream)
2012-02-11 07:39 UTC, cornel panceac
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Manea 2011-12-02 01:54:09 UTC
Version:           unspecified (using KDE 4.6.5) 
OS:                Linux

When launching ktorrent, it will load the main window, but in just a few seconds will crash, with error: 'Signal: Segmentation fault (11)'

Reproducible: Always

Steps to Reproduce:
1. Load 3000 torrents in ktorrent, most of them are completed (seeding), just a few of them are incomplete (still downloading)
2. Start ktorrent

Actual Results:  
ktorrent crashes

Expected Results:  
ktorrent should run normally

I have just over 3000 (three thousands) torrents loaded in ktorrent, most likely this is part of the problem.
I had similar issues in the past while running few hundreds torrents, I managed to work around it by removing all torrents and re-adding them.
In this case, there are way too many torrents so that workaround is not feasible anymore, I'd rather have the problem fixed :)

While I know this is quite large number of torrents for most regular users, this happens when I had much less torrents loaded, so this may be a generic issue that needs to be addressed.

I also have another Virtual Machine with a few hundreds torrents, on which ktorrent crashes as well. We can troubleshoot on that one, if that is easier/better for you.

Fixing this(these) bug(s) would make ktorrent more robust.
Comment 1 Marius Manea 2011-12-02 02:00:11 UTC
to be noted that the original problem occurred on this configuration:

Gentoo Linux with:
kernel 3.1.1, KDE 4.6.5, ktorrent 4.1.1, libktorrent 1.1.1

Steps taken to troubleshoot/fix the problem:
1. upgraded ktorrent to 4.1.2 and libktorrent to 1.1.2 from Gentoo portage, but the problem persists.
2. upgraded ktorrent to 9999 and libktorrent to 9999 from Gentoo 'kde' overlay (these versions are based on ktorrent 4.2dev) but the problem persists.
3. compiled libktorrent/ktorrent from source code latest version and installed them, following the steps here: http://ktorrent.org/wiki/index.php/FAQ#How_do_I_get_the_latest_code_.3F
this didn't help also

I am willing to do any troubleshooting steps and run any debugging programs you need, in order to have this fixed.
Comment 2 Joris Guisson 2011-12-02 17:07:12 UTC
Post the backtrace of the crash
Comment 3 Bogdan Udrescu 2011-12-02 22:46:47 UTC
I'm pretty sure this is related to an old bug, bug 137640. Upgrading your kde version should fix it.
Comment 4 Marius Manea 2011-12-02 22:47:21 UTC
Do you know how to obtain that ? Is it just the report that KDE is generating at the time of crash or I need to take some special steps (using 'gdb' and or other tools) ?
Comment 5 Marius Manea 2011-12-02 22:49:42 UTC
(In reply to comment #3)
> I'm pretty sure this is related to an old bug, bug 137640. Upgrading your kde
> version should fix it.

It is not very likely.
That bug was reported in KDE 4.5.5, I am running KDE 4.6.5..
Comment 6 Marius Manea 2011-12-02 22:51:02 UTC
(In reply to comment #2)
> Post the backtrace of the crash

Do you know how to obtain that ? Is it just the report that KDE is generating
at the time of crash or I need to take some special steps (using 'gdb' and or
other tools) ?
Comment 7 Joris Guisson 2011-12-03 09:27:32 UTC
In the developer information tab of the KDE crash dialog:

http://techbase.kde.org/Development/Tutorials/Debugging/How_to_create_useful_crash_reports#Crash.21
Comment 8 Marius Manea 2011-12-04 15:33:17 UTC
Created attachment 66369 [details]
crash after running overnight
Comment 9 Marius Manea 2011-12-04 15:34:15 UTC
Created attachment 66370 [details]
crash at startup right after loading the main window
Comment 10 Marius Manea 2011-12-04 15:36:54 UTC
Somehow ktorrent managed to start yesterday and I let it run overnight, but it was already in 'crashed' when I checked this morning.
When I try to start it again, sometimes starts, and sometimes crashes right after loading the main window.

I attached both crash files from "Developer" tab, although KDE is complaining that they may not be useful.

Should I recompile ktorrent and libktorrent with "-ggdb" flag as described here, in order to get better backtrace files?
http://www.gentoo.org/proj/en/qa/backtraces.xml
Comment 11 Marius Manea 2011-12-04 19:12:44 UTC
I am trying to generate a useful backtrace log file.
I followed the instructions here:
http://www.gentoo.org/proj/en/qa/backtraces.xml
I enabled -ggdb flag in make.conf and I enabled 'stripdebug' FEATURE in make.conf, after that I recompiled the packages libktorrent and ktorrent.

Then I ran:

marcus@Storage ~ $ gdb /usr/bin/ktorrent 
GNU gdb (Gentoo 7.2 p1) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/ktorrent...Reading symbols from /usr/lib64/debug/usr/bin/ktorrent.debug...done.
done.
(gdb) set logging file backtrace.log
(gdb) set logging on
Copying output to backtrace.log.
(gdb) thread apply all bt full
(gdb) run
Starting program: /usr/bin/ktorrent 
[Thread debugging using libthread_db enabled]
KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work 

Program exited normally.
(gdb) KCrash: Application 'ktorrent' crashing...
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi from kdeinit
sock_file=/home/marcus/.kde4/socket-Storage/kdeinit4__0
Warning: QSocketNotifier: Invalid socket 29 and type 'Read', disabling...

(gdb) thread apply all bt full
(gdb) quit

For some reason, it says "Program exited normally" but immediately after that it is crashing.
Also, nothing useful is recorded in backtrace.log

marcus@Storage ~ $ cat backtrace.log 
Starting program: /usr/bin/ktorrent 
[Thread debugging using libthread_db enabled]

Program exited normally




Any advice on how to get a good backtrace log?
Comment 12 Marius Manea 2011-12-04 21:20:35 UTC
Created attachment 66378 [details]
Backtrace log obtained with gdb. ktorrent crashed right after startup
Comment 13 Marius Manea 2011-12-04 21:22:10 UTC
I figured the problem, I had to do:
(gdb) run --nofork
and then I was able to save the backtrace.
Let me know if this log is useful, I can generate more for you if you need.
I will try to get a valgrind log as well, if you'd like.
Comment 14 Marius Manea 2011-12-07 14:50:25 UTC
Hi, do you have any updates for this bug?
Is the backtrace log helpful at all?
Is there anything else I can help with?
Comment 15 Joris Guisson 2011-12-07 17:30:01 UTC
It is a duplicate of 274544

*** This bug has been marked as a duplicate of bug 274544 ***
Comment 16 Marius Manea 2011-12-07 17:34:02 UTC
If this bug is a duplicate of 27544, how come I am still experiencing it after updating to latest ktorrent?
That bug was marked as fixed..
Comment 17 Joris Guisson 2011-12-08 18:31:56 UTC
latest being ?
Comment 18 Marius Manea 2011-12-08 20:24:10 UTC
(In reply to comment #17)
> latest being ?

I basically followed the instructions here:
http://ktorrent.org/wiki/index.php/FAQ#How_do_I_get_the_latest_code_.3F


To be more precise these are the steps I followed, while logged-in as root:

1. Download source code:
  mkdir /torrentsource
  cd /torrentsource
  git clone git://anongit.kde.org/libktorrent 
  git clone git://anongit.kde.org/ktorrent

2. Compile/install libktorrent:
  cd /torrentsource/libktorrent
  mkdir build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) ..
  make && make install

3. Compile/install ktorrent:
  cd /torrentsource/ktorrent
  mkdir build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) ..
  make && make install


Then I tried launching ktorrent from my regular user 'marcus' and it keeps crashing.
I just performed those steps once more, but still doesn't work.
Please let me know if I did something wrong and if that's the case, how to correct it.

Thanks a lot,
-Marius
Comment 19 Marius Manea 2011-12-09 17:23:52 UTC
Can you please confirm the steps above are correct?
If not, can you please tell me how to get latest ktorrent version so I can test it on my computer?
I now have a similar problem (ktorrent crash at startup) on a virtual machine, I'd like to test it on that machine as well.

thanks a lot,
-Marius
Comment 20 Marius Manea 2011-12-09 21:46:28 UTC
I tried to collect the backtrace from ktorrent crashing on the virtual machine, however something is not working properly (or I am not doing it right).
It seems that after crashing, no backtrace cam be generated:


Marcus@DL1 ~ $ gdb /usr/bin/ktorrent 
GNU gdb (Gentoo 7.2 p1) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/ktorrent...Reading symbols from /usr/lib64/debug/usr/bin/ktorrent.debug...done.
done.
(gdb) run --nofork
Starting program: /usr/bin/ktorrent --nofork
[Thread debugging using libthread_db enabled]
KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work 
[New Thread 0x7fffe8da0700 (LWP 29117)]
[Thread 0x7fffe8da0700 (LWP 29117) exited]
[New Thread 0x7fffe8da0700 (LWP 29118)]
Warning: Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

[Thread 0x7fffe8da0700 (LWP 29118) exited]

Program exited normally.
(gdb) set logging file backtrace.log
(gdb) set logging on
Copying output to backtrace.log.
(gdb) thread apply all bt full
(gdb) bt
No stack.
(gdb) quit
marcus@DL1 ~ $ cat backtrace.log 
No stack.
Comment 21 Marius Manea 2011-12-09 21:52:38 UTC
Hi Joris,

I would really appreciate if you could give this bug a higher priority.
I am getting very late responses from you, this way it would take forever to troubleshoot/fix the problem.
I already have two machines with ktorrent crashing (with slightly different behavior though).

As I said before I am willing to spend as much time needed and to run any troubleshooting steps in order to have this fixed. ktorrent is very buggy in this current state, and I would be happy to help improving it.
But that would require a bit more commitment from your side.

thank you,
-Marius
Comment 22 Marius Manea 2011-12-12 04:33:44 UTC
Can we please reassign this bug to someone else which has the time/commitment to work on it?
Comment 23 Myriam Schweingruber 2011-12-12 09:25:50 UTC
Marius, please be patient. Joris is the maintainer of KTorrent and he also has a day job and is working on this in his free time. AFAIK you are not paying him for the work he is doing.
FWIW: I wasn't able to reproduce this despite several tries.
Comment 24 Marius Manea 2011-12-12 12:39:36 UTC
Hi Myriam,

Can you please confirm at least if the steps I described at Comment #18 are the correct ones to get the latest version of the code?
Otherwise please provide the correct steps to follow.
Joris stated this is a duplicate bug, but it is critical to verify that I am running latest version. If I am indeed running latest version and ktorrent is still crashing that means this bug isn't a duplicate of another bug and should be properly investigated, am I correct?

best regards,
-Marius
Comment 25 Joris Guisson 2011-12-13 19:39:13 UTC
So you are running latest code, then my fix doesn't fix the problem.

It crashes somewhere in Qt, but I'm not sure if it is actually a Qt problem. I thought it had something to do with running out of file descriptors, but that should no longer be the problem with my previous fix.
Comment 26 Marius Manea 2011-12-15 03:08:10 UTC
What are the next steps, how do we get to the bottom of the problem so we can fix it?
Also, we should un-mark this bug as Resolved/Duplicate, is that correct?

These crashes happens very often, usually when I have more than 50-100 torrents in mixed status (seeding/downloading), ktorrent would always crash at startup.

I have that VM where I am also running ktorrent, and ktorrent is barely usable.
I have to remove torrents manually one by one from the folder where it keeps the torrent information (those "torXYZ" folders, where X, Y, Z are digits 0 to 9) in order to have ktorrent starting up again without crashing...
Comment 27 Alexey Shildyakov 2011-12-21 13:47:56 UTC
Hmmm... Marius, could you, please:
1. Reemerge libktorrent-9999 and ktorrent-9999 again and
2. provide us the valgrind log:
valgrind -v --log-file=%p.log --num-callers=50 ktorrent --nofork
Comment 28 cornel panceac 2012-02-11 07:39:06 UTC
Created attachment 68695 [details]
ktorrent crash at startup, backtrace
Comment 29 Joris Guisson 2012-03-24 11:45:53 UTC
Without the valgrind trace, this is impossible to fix.