[ktorrent] [Bug 523761] libktorrent segfault on authenticationFinished

[email protected]
Newsgroups gmane.comp.kde.devel.bugs
Message-ID <[email protected]/>
https://bugs.kde.org/show_bug.cgi?id=523761

--- Comment #3 from [email protected] ---
I made the following changes over e5636364de1642f222528c3e16b849b55843ce70 and
got some interesting outputs over 2 days...

```
diff --git a/src/peer/peerconnector.cpp b/src/peer/peerconnector.cpp
index c1b41258..a514beeb 100644
--- a/src/peer/peerconnector.cpp
+++ b/src/peer/peerconnector.cpp
@@ -4,6 +4,7 @@
     SPDX-License-Identifier: GPL-2.0-or-later
 */

+#include <QDebug>
 #include "peerconnector.h"
 #include "authenticationmonitor.h"
 #include "peermanager.h"
@@ -34,6 +35,7 @@ public:

     ~Private()
     {
+   qDebug () << QDateTime::currentDateTime () << "deleting
PeerConnector::Private " << this << " of PeerConnector: " << p;
         if (auth.data()) {
             stopping = true;
             auth.data()->stop();
@@ -61,10 +63,12 @@ PeerConnector::PeerConnector(const net::Address &addr, bool
local, bt::PeerManag
     : Resource(&half_open_connections,
pman.getTorrent().getInfoHash().toString())
     , d(std::make_unique<Private>(this, addr, local, pman, std::move(token)))
 {
+   qDebug () << QDateTime::currentDateTime () << "creating PeerConnector: " <<
this << " Private: " << d.get ();
 }

 PeerConnector::~PeerConnector()
 {
+   qDebug () << QDateTime::currentDateTime () << "deleting PeerConnector: " <<
this;
 }

 void PeerConnector::setMaxActive(Uint32 mc)
@@ -105,6 +109,7 @@ void PeerConnector::acquired()

 void PeerConnector::authenticationFinished(Authenticate *auth, bool ok)
 {
+   qDebug () << QDateTime::currentDateTime () << "using PeerConnector::Private
" << d.get () << "of PeerConnector" << this;
     d->authenticationFinished(auth, ok);
 }

```

SAMPLES
The whole outputs are in MBs, so I'll spare you the effort and just give the
part right before the crash.

1.
QDateTime(2026-08-07 00:58:00.056 IST Qt::LocalTime) creating PeerConnector: 
0x557d77e3fb80  Private:  0x557d77e3fbc0
...
QDateTime(2026-08-07 00:58:07.047 IST Qt::LocalTime) using
PeerConnector::Private  0x557d77e3fbc0 of PeerConnector 0x557d77e3fb80
QDateTime(2026-08-07 00:58:07.047 IST Qt::LocalTime) deleting PeerConnector: 
0x557d77e3fb80
QDateTime(2026-08-07 00:58:07.047 IST Qt::LocalTime) deleting
PeerConnector::Private  0x557d77e3fbc0  of PeerConnector:  0x557d77e3fb80
QDateTime(2026-08-07 00:58:07.047 IST Qt::LocalTime) using
PeerConnector::Private  0x740020006e006f of PeerConnector 0x557d77e3fb80
KCrash: Application 'ktorrent' crashing... crashRecursionCounter = 2
./run.sh: line 10: 115433 Segmentation fault         (core dumped) bin/ktorrent
--verbose

✘ SEGV  16m 47s 

2.
QDateTime(2026-08-07 00:40:41.035 IST Qt::LocalTime) creating PeerConnector: 
0x556819b22eb0  Private:  0x556815de3cd0
...
QDateTime(2026-08-07 00:40:48.026 IST Qt::LocalTime) using
PeerConnector::Private  0x556815de3cd0 of PeerConnector 0x556819b22eb0
QDateTime(2026-08-07 00:40:48.026 IST Qt::LocalTime) deleting PeerConnector: 
0x556819b22eb0
QDateTime(2026-08-07 00:40:48.026 IST Qt::LocalTime) deleting
PeerConnector::Private  0x556815de3cd0  of PeerConnector:  0x556819b22eb0
QDateTime(2026-08-07 00:40:48.026 IST Qt::LocalTime) using
PeerConnector::Private  0x740020006e006f of PeerConnector 0x556819b22eb0
KCrash: Application 'ktorrent' crashing... crashRecursionCounter = 2
./run.sh: line 10: 93251 Segmentation fault         (core dumped) bin/ktorrent
--verbose

✘ SEGV  17m 26s

3.
QDateTime(2026-08-06 10:12:58.062 IST Qt::LocalTime) creating PeerConnector: 
0x55e08e3449d0  Private:  0x55e08ca6a570
...
QDateTime(2026-08-06 10:13:05.052 IST Qt::LocalTime) using
PeerConnector::Private  0x55e08ca6a570 of PeerConnector 0x55e08e3449d0
QDateTime(2026-08-06 10:13:05.052 IST Qt::LocalTime) deleting PeerConnector: 
0x55e08e3449d0
QDateTime(2026-08-06 10:13:05.052 IST Qt::LocalTime) deleting
PeerConnector::Private  0x55e08ca6a570  of PeerConnector:  0x55e08e3449d0
QDateTime(2026-08-06 10:13:05.052 IST Qt::LocalTime) using
PeerConnector::Private  0x0 of PeerConnector 0x55e08e3449d0
KCrash: Application 'ktorrent' crashing... crashRecursionCounter = 2
./run.sh: line 10: 2072844 Segmentation fault         (core dumped)
bin/ktorrent --verbose

✘ SEGV  12m 40s

___

Do note that I have built (and run) this with kconfig 6.28.0-1 and kcoreaddons
6.28.0-1 , so in case you think that the problem might be with the version,
then feel free to ignore this. I will consider using kdesrc-build/kde-builder
in case this might be the reason.

This is indeed weird, though.
I will try reverting bae6085261a6c1571a880ae1e053746270af6b8d and
d6dec56102cd26ba837fe6f5e5956170eaf97b0d and come back with any interesting
results.

-- 
You are receiving this mail because:
You are watching all bug changes.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.