Summary: | Torrent up/download freezes, then ktorrent crashes when doing exit. | ||
---|---|---|---|
Product: | [Applications] ktorrent | Reporter: | thordn |
Component: | general | Assignee: | Joris Guisson <joris.guisson> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | andrestepeite, marko.gabriel.cz, thordn |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Slackware | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | valgrind log as requested. This time ktorrent crashed with segfault without user intervention. |
Description
thordn
2011-01-02 22:14:24 UTC
What would be interesting if you would run ktorrent under valgrind: valgrind --log-file=vg.log /usr/bin/ktorrent --nofork Post the vg.log file. Note that running things under valgrind is slow, but it should result in valuable information. Created attachment 55578 [details]
valgrind log as requested.
This time ktorrent crashed with segfault without user intervention.
When the log was made, ktorrent segfaulted without any user intervention. This is very interesting, I think I see what is causing it. commit ddc854c6365c355f6b1d80276db70b5f57657836 branch master Author: Joris <joris.guisson@gmail.com> Date: Wed Jan 5 20:11:02 2011 +0100 Fix crash due to manipulating timers in the wrong thread BUG: 261903 diff --git a/ChangeLog b/ChangeLog index 00b85e4..4aa73d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Changes in 1.2: Changes in 1.1rc1: - Fix bug in UPnP so that it works properly with D-Link DIR 635 routers +- Fix crash due to manipulating timers in the wrong thread (261903) Changes in 1.1beta1: - Use UTF-8 as default codec in bt::Value::toString diff --git a/src/download/httpconnection.cpp b/src/download/httpconnection.cpp index 536e1aa..51fc500 100644 --- a/src/download/httpconnection.cpp +++ b/src/download/httpconnection.cpp @@ -37,8 +37,12 @@ namespace bt status = i18n("Not connected"); connect(&reply_timer,SIGNAL(timeout()),this,SLOT(replyTimeout())); connect(&connect_timer,SIGNAL(timeout()),this,SLOT(connectTimeout())); + connect(this,SIGNAL(startReplyTimer(int)),&reply_timer,SLOT(start(int)),Qt::QueuedConnection); + connect(this,SIGNAL(stopReplyTimer()),&reply_timer,SLOT(stop()),Qt::QueuedConnection); + connect(this,SIGNAL(stopConnectTimer()),&connect_timer,SLOT(stop()),Qt::QueuedConnection); up_gid = down_gid = 0; close_when_finished = false; + redirected = false; } @@ -133,7 +137,7 @@ namespace bt response_code = request->response_code; } else if (request->response_header_received) - reply_timer.stop(); + stopReplyTimer(); } } } @@ -154,7 +158,7 @@ namespace bt state = ERROR; status = i18n("Error: Failed to connect to webseed"); } - connect_timer.stop(); + stopConnectTimer(); } else if (state == ACTIVE && request) { @@ -173,7 +177,7 @@ namespace bt g->buffer.clear(); g->request_sent = true; // wait 60 seconds for a reply - reply_timer.start(60 * 1000); + startReplyTimer(60 * 1000); } return len; } @@ -324,9 +328,12 @@ namespace bt void HttpConnection::replyTimeout() { QMutexLocker locker(&mutex); - status = i18n("Error: request timed out"); - state = ERROR; - reply_timer.stop(); + if (!request || !request->response_header_received) + { + status = i18n("Error: request timed out"); + state = ERROR; + reply_timer.stop(); + } } //////////////////////////////////////////// diff --git a/src/download/httpconnection.h b/src/download/httpconnection.h index 4a5c319..c2a8414 100644 --- a/src/download/httpconnection.h +++ b/src/download/httpconnection.h @@ -160,6 +160,11 @@ namespace bt void hostResolved(KNetwork::KResolverResults res); void connectTimeout(); void replyTimeout(); + + signals: + void startReplyTimer(int timeout); + void stopReplyTimer(); + void stopConnectTimer(); }; } commit 8059530289168be14f26a4786e9dd8cf18d67f90 branch 1.1 Author: Joris <joris.guisson@gmail.com> Date: Wed Jan 5 20:11:02 2011 +0100 Backport fix crash due to manipulating timers in the wrong thread to 1.1 branch CCBUG: 261903 diff --git a/ChangeLog b/ChangeLog index 70eae64..026c730 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Changes in 1.1rc1: - Fix bug in UPnP so that it works properly with D-Link DIR 635 routers +- Fix crash due to manipulating timers in the wrong thread (261903) Changes in 1.1beta1: - Use UTF-8 as default codec in bt::Value::toString diff --git a/src/download/httpconnection.cpp b/src/download/httpconnection.cpp index 536e1aa..51fc500 100644 --- a/src/download/httpconnection.cpp +++ b/src/download/httpconnection.cpp @@ -37,8 +37,12 @@ namespace bt status = i18n("Not connected"); connect(&reply_timer,SIGNAL(timeout()),this,SLOT(replyTimeout())); connect(&connect_timer,SIGNAL(timeout()),this,SLOT(connectTimeout())); + connect(this,SIGNAL(startReplyTimer(int)),&reply_timer,SLOT(start(int)),Qt::QueuedConnection); + connect(this,SIGNAL(stopReplyTimer()),&reply_timer,SLOT(stop()),Qt::QueuedConnection); + connect(this,SIGNAL(stopConnectTimer()),&connect_timer,SLOT(stop()),Qt::QueuedConnection); up_gid = down_gid = 0; close_when_finished = false; + redirected = false; } @@ -133,7 +137,7 @@ namespace bt response_code = request->response_code; } else if (request->response_header_received) - reply_timer.stop(); + stopReplyTimer(); } } } @@ -154,7 +158,7 @@ namespace bt state = ERROR; status = i18n("Error: Failed to connect to webseed"); } - connect_timer.stop(); + stopConnectTimer(); } else if (state == ACTIVE && request) { @@ -173,7 +177,7 @@ namespace bt g->buffer.clear(); g->request_sent = true; // wait 60 seconds for a reply - reply_timer.start(60 * 1000); + startReplyTimer(60 * 1000); } return len; } @@ -324,9 +328,12 @@ namespace bt void HttpConnection::replyTimeout() { QMutexLocker locker(&mutex); - status = i18n("Error: request timed out"); - state = ERROR; - reply_timer.stop(); + if (!request || !request->response_header_received) + { + status = i18n("Error: request timed out"); + state = ERROR; + reply_timer.stop(); + } } //////////////////////////////////////////// diff --git a/src/download/httpconnection.h b/src/download/httpconnection.h index 4a5c319..c2a8414 100644 --- a/src/download/httpconnection.h +++ b/src/download/httpconnection.h @@ -160,6 +160,11 @@ namespace bt void hostResolved(KNetwork::KResolverResults res); void connectTimeout(); void replyTimeout(); + + signals: + void startReplyTimer(int timeout); + void stopReplyTimer(); + void stopConnectTimer(); }; } *** Bug 261902 has been marked as a duplicate of this bug. *** *** Bug 261346 has been marked as a duplicate of this bug. *** I have now tested this patch for a while. I could not compile 1.1beta, so ported it back to libktorrent-1.0.5-3 and running 4.0.5. No crashes sofar. However after 1-2 hours the up/downloading stops. I have checked the "reduce priority" on stalled torrent and set timeout to 1 minute. When stopped and if I do: find . -name "stats" -exec grep PRIORITY {} \; I see PRIORITY=xxx mostly in the range of 1 to 8, after exiting ktorrent the values are a few thousands. Is this the way it is supposed to work? When restarting ktorrent the up/downloading continues for another 1-2 hours then stops. Another thing I see when removing a completed torrent is the warning: Warning: QTreeView::rowsInserted internal representation of the model has been corrupted, resetting. Don't know if this is a problem tough. /Thord. *** Bug 257668 has been marked as a duplicate of this bug. *** |