Bug 148176 - Crash when "Use DHT..." is turned on
Summary: Crash when "Use DHT..." is turned on
Status: RESOLVED UNMAINTAINED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-24 21:59 UTC by PhobosK
Modified: 2011-07-25 20:28 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description PhobosK 2007-07-24 21:59:50 UTC
Version:           2.2.1 (using KDE 3.5.7, Gentoo)
Compiler:          Target: x86_64-pc-linux-gnu
OS:                Linux (x86_64) release 2.6.22-gentoo-r1

This is generally a duplicate of bug #144416 that has been ?! RESOLVED ?! .... BUT i don't see it resolved at all.

I have this bug from several versions ago (at least 3 official versions) and it is still blocking my use of ktorrent if DHT is ON. The last two official releases make it worse. Now what happens is:
(case 1) WHEN NO TORRENTS IN LIST OR NO TORRENTS ACTIVE IN THE LIST- ktorrent crashes nearly every 4-5 minutes without any user intervention.
(case 2) WHEN THERE IS ANY ACTIVE TORRENT - ktorrent crashes immediately after the start (the same applies when starting any torrent in case (1)) and the only "cure" for this is to edit the ktorrentrc file and make the option for DHT to false.

All these crashes don't happen if DHT is OFF.

And here is the crash debug from case (1):
------------------------------------------
#5  0x00002b5d5a9fee35 in raise () from /lib/libc.so.6
#6  0x00002b5d5aa0019e in abort () from /lib/libc.so.6
#7  0x00002b5d5b4c9fc6 in sockaddr2sockshost () from /usr/lib64/libsocks.so
#8  0x00002b5d5b4c6001 in udpsetup () from /usr/lib64/libsocks.so
#9  0x00002b5d5b4c68e0 in Rsendto () from /usr/lib64/libsocks.so
#10 0x00002b5d5687caf5 in KNetwork::KSocksSocketDevice::writeBlock ()
   from /usr/kde/3.5/lib64/libkdecore.so.4
#11 0x00002b5d56877022 in KNetwork::KClientSocketBase::writeBlock ()
   from /usr/kde/3.5/lib64/libkdecore.so.4
#12 0x00002b5d555c3bc6 in dht::RPCServer::send ()
   from /usr/lib64/libktorrent-2.2.1.so
#13 0x00002b5d555c3c81 in dht::RPCServer::sendMsg ()
   from /usr/lib64/libktorrent-2.2.1.so
#14 0x00002b5d555c4019 in dht::RPCServer::doCall ()
   from /usr/lib64/libktorrent-2.2.1.so
#15 0x00002b5d555d0d49 in dht::Task::rpcCall ()
   from /usr/lib64/libktorrent-2.2.1.so
#16 0x00002b5d555d09dc in dht::NodeLookup::update ()
   from /usr/lib64/libktorrent-2.2.1.so
#17 0x00002b5d555d109b in dht::Task::start ()
   from /usr/lib64/libktorrent-2.2.1.so
#18 0x00002b5d555c8582 in dht::DHT::refreshBucket ()
   from /usr/lib64/libktorrent-2.2.1.so
#19 0x00002b5d555bfdb6 in dht::Node::refreshBuckets ()
   from /usr/lib64/libktorrent-2.2.1.so
#20 0x00002b5d555c8348 in dht::DHT::update ()
   from /usr/lib64/libktorrent-2.2.1.so
#21 0x00002b5d555c81f1 in dht::DHT::qt_invoke ()
   from /usr/lib64/libktorrent-2.2.1.so
#22 0x00002b5d57448a0c in QObject::activate_signal ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#23 0x00002b5d57449943 in QObject::activate_signal ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#24 0x00002b5d5783c78e in QTimer::timeout ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#25 0x00002b5d574768b1 in QTimer::event () from /usr/qt/3/lib64/libqt-mt.so.3
#26 0x00002b5d573d5c3a in QApplication::internalNotify ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#27 0x00002b5d573d7b89 in QApplication::notify ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#28 0x00002b5d567831ca in KApplication::notify ()
   from /usr/kde/3.5/lib64/libkdecore.so.4
#29 0x00002b5d558cd680 in QApplication::sendEvent ()
   from /usr/kde/3.5/lib64/libkparts.so.2
#30 0x00002b5d573c712c in QEventLoop::activateTimers ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#31 0x00002b5d57372c4b in QEventLoop::processEvents ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#32 0x00002b5d573f378a in QEventLoop::enterLoop ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#33 0x00002b5d573f3593 in QEventLoop::exec ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#34 0x00002b5d573d788e in QApplication::exec ()
   from /usr/qt/3/lib64/libqt-mt.so.3

Here it is from case (2):
-------------------------
#5  0x00002b267070be35 in raise () from /lib/libc.so.6
#6  0x00002b267070d19e in abort () from /lib/libc.so.6
#7  0x00002b26711d7fc6 in sockaddr2sockshost () from /usr/lib64/libsocks.so
#8  0x00002b26711d4001 in udpsetup () from /usr/lib64/libsocks.so
#9  0x00002b26711d48e0 in Rsendto () from /usr/lib64/libsocks.so
#10 0x00002b266c589af5 in KNetwork::KSocksSocketDevice::writeBlock ()
   from /usr/kde/3.5/lib64/libkdecore.so.4
#11 0x00002b266c584022 in KNetwork::KClientSocketBase::writeBlock ()
   from /usr/kde/3.5/lib64/libkdecore.so.4
#12 0x00002b266b2d0bc6 in dht::RPCServer::send ()
   from /usr/lib64/libktorrent-2.2.1.so
#13 0x00002b266b2d0c81 in dht::RPCServer::sendMsg ()
   from /usr/lib64/libktorrent-2.2.1.so
#14 0x00002b266b2d1019 in dht::RPCServer::doCall ()
   from /usr/lib64/libktorrent-2.2.1.so
#15 0x00002b266b2ddd49 in dht::Task::rpcCall ()
   from /usr/lib64/libktorrent-2.2.1.so
#16 0x00002b266b2e020c in dht::AnnounceTask::update ()
   from /usr/lib64/libktorrent-2.2.1.so
#17 0x00002b266b2de09b in dht::Task::start ()
   from /usr/lib64/libktorrent-2.2.1.so
#18 0x00002b266b2d56ef in dht::DHT::announce ()
   from /usr/lib64/libktorrent-2.2.1.so
#19 0x00002b266b2e1a08 in dht::DHTTrackerBackend::doRequest ()
   from /usr/lib64/libktorrent-2.2.1.so
#20 0x00002b266b2c8371 in bt::PeerSourceManager::start ()
   from /usr/lib64/libktorrent-2.2.1.so
#21 0x00002b266b28f153 in bt::TorrentControl::continueStart ()
   from /usr/lib64/libktorrent-2.2.1.so
#22 0x00002b266b2919c2 in bt::TorrentControl::update ()
   from /usr/lib64/libktorrent-2.2.1.so
#23 0x00000000004359de in ?? ()
#24 0x000000000043c385 in ?? ()
#25 0x00002b266d155a0c in QObject::activate_signal ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#26 0x00002b266d156943 in QObject::activate_signal ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#27 0x00002b266d54978e in QTimer::timeout ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#28 0x00002b266d1838b1 in QTimer::event () from /usr/qt/3/lib64/libqt-mt.so.3
#29 0x00002b266d0e2c3a in QApplication::internalNotify ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#30 0x00002b266d0e4b89 in QApplication::notify ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#31 0x00002b266c4901ca in KApplication::notify ()
   from /usr/kde/3.5/lib64/libkdecore.so.4
#32 0x00002b266b5da680 in QApplication::sendEvent ()
   from /usr/kde/3.5/lib64/libkparts.so.2
#33 0x00002b266d0d412c in QEventLoop::activateTimers ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#34 0x00002b266d07fc4b in QEventLoop::processEvents ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#35 0x00002b266d10078a in QEventLoop::enterLoop ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#36 0x00002b266d100593 in QEventLoop::exec ()
   from /usr/qt/3/lib64/libqt-mt.so.3
#37 0x00002b266d0e488e in QApplication::exec ()
   from /usr/qt/3/lib64/libqt-mt.so.3

BTW - just for your info about this Gentoo ebuild is that it uses natural configure/make/make install (i.e. no tweaks or patches) and the only option it turns on is "--enable-knetwork"
Comment 1 Joris Guisson 2007-07-25 11:24:45 UTC
This is not 144416, this is a crash in libsocks, which is part of dante. 

You see dante does not handle IPv6, and the moment it sees something it doesn't like, it craps out, it just calls abort(), which will cause the application using it to exit with a SIGABRT. 

I'm going to pass this bug to the person in charge of kdelibs, because KSocks should not pass AF_INET6 addresses to dante. 


Comment 2 Joris Guisson 2007-07-25 11:30:14 UTC
Btw, the offending function in the dante code is this (lib/util.c) :

struct sockshost_t *
sockaddr2sockshost(addr, host)
        const struct sockaddr *addr;
        struct sockshost_t *host;
{

        switch (addr->sa_family) {
                case AF_INET:
                        host->atype                     = SOCKS_ADDR_IPV4;
                        /* LINTED pointer casts may be troublesome */
                        host->addr.ipv4 = TOCIN(addr)->sin_addr;
                        /* LINTED pointer casts may be troublesome */
                        host->port                      = TOCIN(addr)->sin_port;
                        break;

                default:
                        SERRX(addr->sa_family);
        }

        return host;
}

And the SERRX macro is defined as this (include/common.h) :

#define SERRX(failure)                          \
do {                                                                            \
        SWARNX(failure);                                        \
        abort();                                                                \
} while (lintnoloop_common_h)

This is just horrible, wtf where the dante people thinking when they wrote this ?
Comment 3 Christoph Feck 2011-07-25 20:28:56 UTC
This crash is from the KDE 3 version of KTorrent, which is no longer maintained. If you are experiencing it with KDE 4, please report a new bug or add an updated backtrace.