Bug 387523 - Uncaught exception: std::bad_alloc
Summary: Uncaught exception: std::bad_alloc
Status: RESOLVED WORKSFORME
Alias: None
Product: ktorrent
Classification: Applications
Component: general (other bugs)
Version First Reported In: 5.1
Platform: Fedora RPMs Linux
: NOR critical
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-02 09:34 UTC by Germano Massullo (Thetra)
Modified: 2022-11-18 15:06 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Germano Massullo (Thetra) 2017-12-02 09:34:20 UTC
This is the GDB tail output I am getting while running
$ gdb ktorrent
(gdb) run


mmap failed : Cannot allocate memory
mmap failed : Cannot allocate memory
mmap failed : Cannot allocate memory
Uncaught exception: std::bad_alloc
[Thread 0x7fffd1581700 (LWP 20000) exited]
[Thread 0x7fffd93ff700 (LWP 19997) exited]
[Thread 0x7fffd2f93700 (LWP 19998) exited]
[Inferior 1 (process 19993) exited normally]

After that no KTorrent process will run.

$ free -m
              total        used        free      shared  buff/cache   available
Mem:          16041        4904        2827         477        8310       11462
Comment 1 Germano Massullo (Thetra) 2017-12-02 09:34:36 UTC
ktorrent-5.0.1-5.fc27.x86_64
Comment 2 Germano Massullo (Thetra) 2017-12-05 21:52:37 UTC
This happens everytime I try to run ktorrent
Comment 3 Germano Massullo (Thetra) 2017-12-05 22:19:35 UTC
dfaure in IRC suggested me to use
(gdb) catch throw
before
(gdb) run
so this is the new piece of GDB backtrace that was not available before

Thread 1 "ktorrent" hit Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0x7fffc7cedba0, tinfo=0x7ffff0177750 <typeinfo for std::bad_alloc>, 
    dest=0x7fffefe8cf00 <std::bad_alloc::~bad_alloc()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:76
76        PROBE2 (throw, obj, tinfo);
Comment 4 Germano Massullo (Thetra) 2017-12-05 22:24:16 UTC
This time backtrace command worked
(gdb) bt
#0  __cxxabiv1::__cxa_throw (obj=0x7fffc7cedba0, tinfo=0x7ffff0177750 <typeinfo for std::bad_alloc>, dest=0x7fffefe8cf00 <std::bad_alloc::~bad_alloc()>)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:76
#1  0x00007fffefe8f42c in operator new (sz=sz@entry=16384) at ../../../../libstdc++-v3/libsupc++/new_op.cc:54
#2  0x00007fffefe8f495 in operator new[] (sz=sz@entry=16384) at ../../../../libstdc++-v3/libsupc++/new_opv.cc:32
#3  0x00007ffff786a2f9 in bt::MultiFileCache::createPiece (this=this@entry=0x7fffc7cc6bd0, c=c@entry=0x7fffc7cff250, off=off@entry=360448, 
    length=length@entry=16384, read_only=read_only@entry=false) at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/diskio/multifilecache.cpp:432
#4  0x00007ffff786a6f7 in bt::MultiFileCache::preparePiece (this=0x7fffc7cc6bd0, c=0x7fffc7cff250, off=360448, length=16384)
    at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/diskio/multifilecache.cpp:444
#5  0x00007ffff7862b76 in bt::Chunk::getPiece (this=<optimized out>, off=<optimized out>, len=<optimized out>, read_only=read_only@entry=false)
    at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/diskio/chunk.cpp:65
#6  0x00007ffff7813df3 in bt::ChunkDownload::load (this=this@entry=0x7fffffffcf50, file=..., hdr=..., update_hash=update_hash@entry=false)
    at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/download/chunkdownload.cpp:459
#7  0x00007ffff781a12c in bt::Downloader::getDownloadedBytesOfCurrentChunksFile (this=this@entry=0x7fffc6553270, file=...)
    at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/download/downloader.cpp:687
#8  0x00007ffff783613e in bt::TorrentControl::initInternal (this=this@entry=0x7fffc6596ee0, qman=qman@entry=0x555555999bb0, tmpdir=..., ddir=...)
    at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/torrent/torrentcontrol.cpp:667
#9  0x00007ffff7837376 in bt::TorrentControl::init (this=this@entry=0x7fffc6596ee0, qman=0x555555999bb0, data=..., tmpdir=..., ddir=...)
    at /usr/src/debug/kf5-libktorrent-2.0.1-9.fc27.x86_64/src/torrent/torrentcontrol.cpp:547
#10 0x0000555555590d46 in kt::Core::loadExistingTorrent (this=0x555555934160, tor_dir=...) at /usr/src/debug/ktorrent-5.0.1-5.fc27.x86_64/ktorrent/core.cpp:666
#11 0x000055555558ff7c in kt::Core::loadTorrents (this=0x555555934160) at /usr/src/debug/ktorrent-5.0.1-5.fc27.x86_64/ktorrent/core.cpp:698
#12 0x000055555559e4c1 in kt::GUI::GUI (this=0x7fffffffd4d0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
    at /usr/src/debug/ktorrent-5.0.1-5.fc27.x86_64/ktorrent/gui.cpp:84
#13 0x000055555558c852 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/ktorrent-5.0.1-5.fc27.x86_64/ktorrent/main.cpp:209
Comment 5 Germano Massullo (Thetra) 2017-12-06 07:22:13 UTC
=== Updated to KTorrent version 5.1.0 ===

Thread 1 "ktorrent" hit Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0x7fffc7cbf0c0, tinfo=0x7ffff0cdb750 <typeinfo for std::bad_alloc>, 
    dest=0x7ffff09f0f00 <std::bad_alloc::~bad_alloc()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:76
76        PROBE2 (throw, obj, tinfo);
(gdb) bt
#0  __cxxabiv1::__cxa_throw (obj=0x7fffc7cbf0c0, tinfo=0x7ffff0cdb750 <typeinfo for std::bad_alloc>, dest=0x7ffff09f0f00 <std::bad_alloc::~bad_alloc()>)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:76
#1  0x00007ffff09f342c in operator new (sz=sz@entry=16384) at ../../../../libstdc++-v3/libsupc++/new_op.cc:54
#2  0x00007ffff09f3495 in operator new[] (sz=sz@entry=16384) at ../../../../libstdc++-v3/libsupc++/new_opv.cc:32
#3  0x00007ffff7869d69 in bt::MultiFileCache::createPiece (this=this@entry=0x7fffc651f550, c=c@entry=0x7fffc7ccfc40, off=off@entry=573440, 
    length=length@entry=16384, read_only=read_only@entry=false) at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/diskio/multifilecache.cpp:432
#4  0x00007ffff786a167 in bt::MultiFileCache::preparePiece (this=0x7fffc651f550, c=0x7fffc7ccfc40, off=573440, length=16384)
    at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/diskio/multifilecache.cpp:444
#5  0x00007ffff78625e6 in bt::Chunk::getPiece (this=<optimized out>, off=<optimized out>, len=<optimized out>, read_only=read_only@entry=false)
    at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/diskio/chunk.cpp:65
#6  0x00007ffff78125b3 in bt::ChunkDownload::load (this=this@entry=0x7fffffffcf60, file=..., hdr=..., update_hash=update_hash@entry=false)
    at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/download/chunkdownload.cpp:459
#7  0x00007ffff78188ec in bt::Downloader::getDownloadedBytesOfCurrentChunksFile (this=this@entry=0x7fffc6524270, file=...)
    at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/download/downloader.cpp:687
#8  0x00007ffff7835c8e in bt::TorrentControl::initInternal (this=this@entry=0x7fffc6566eb0, qman=qman@entry=0x55555598a480, tmpdir=..., ddir=...)
    at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/torrent/torrentcontrol.cpp:667
#9  0x00007ffff7836ec6 in bt::TorrentControl::init (this=this@entry=0x7fffc6566eb0, qman=0x55555598a480, data=..., tmpdir=..., ddir=...)
    at /usr/src/debug/kf5-libktorrent-2.1-1.fc27.x86_64/src/torrent/torrentcontrol.cpp:547
#10 0x000055555559abb5 in kt::Core::loadExistingTorrent (this=0x555555959480, tor_dir=...) at /usr/src/debug/ktorrent-5.1.0-2.fc27.x86_64/ktorrent/core.cpp:669
#11 0x0000555555599e2c in kt::Core::loadTorrents (this=0x555555959480) at /usr/src/debug/ktorrent-5.1.0-2.fc27.x86_64/ktorrent/core.cpp:701
#12 0x00005555555a8cb1 in kt::GUI::GUI (this=0x7fffffffd4d0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
    at /usr/src/debug/ktorrent-5.1.0-2.fc27.x86_64/ktorrent/gui.cpp:85
#13 0x0000555555596e70 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/ktorrent-5.1.0-2.fc27.x86_64/ktorrent/main.cpp:212
(gdb)
Comment 6 fassadourian 2018-01-04 04:32:30 UTC
I got the same error message today. In my case, I was able to pinpoint the cause as being a specific torrent information folder in my .local/share/ktorrent  

By removing it, ktorrent was able to start. Adding it back triggered the std::bad_alloc message.
Comment 7 Germano Massullo (Thetra) 2018-01-19 09:05:22 UTC
(In reply to Fabrice Assadourian from comment #6)
> I got the same error message today. In my case, I was able to pinpoint the
> cause as being a specific torrent information folder in my
> .local/share/ktorrent  
> 
> By removing it, ktorrent was able to start. Adding it back triggered the
> std::bad_alloc message.

Exactly, the same here. But I cannot find out which is the specific subfolder that triggers it
Comment 8 Germano Massullo (Thetra) 2018-03-13 17:52:11 UTC
Is KTorrent still maintained?
Comment 9 Christoph Feck 2018-03-30 18:11:10 UTC
No, it is a volunteer-driven project (like probably most KDE projects).
Comment 10 Justin Zobel 2022-11-18 04:30:15 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 11 Germano Massullo (Thetra) 2022-11-18 15:06:05 UTC
I am no longer experiencing the problem on ktorrent-22.08.1-1.fc36.x86_64