Bug#472054: knode: Too many scheduling interrupts
Package: knode
Version: 4:3.5.9-2
Severity: normal
Tags: patch
Knode has too many interrupts (checked with powertop). This bug has been
reported upstream[1], but no action has been taken yet. On said bug, a
patch was supplied, but it was broken (doesn't compile).
Attached is a fixed patch that seems to fix the issue.
[1] http://bugs.kde.org/show_bug.cgi?id=147944
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages knode depends on:
ii kdelibs4c2a 4:3.5.9.dfsg.1-2 core libraries and binaries for al
ii libc6 2.7-9 GNU C Library: Shared libraries
ii libgcc1 1:4.3.0-1 GCC support library
ii libkdepim1a 4:3.5.9-2 KDE PIM library
ii libkleopatra1 4:3.5.9-2 KDE GnuPG interface libraries
ii libkmime2 4:3.5.9-2 KDE MIME interface library
ii libqt3-mt 3:3.3.8b-5 Qt GUI Library (Threaded runtime v
ii libstdc++6 4.3.0-1 The GNU Standard C++ Library v3
knode recommends no packages.
-- no debconf information
diff -Nru -x Makefile.in kdepim-3.5.9/knode/knnetaccess.cpp kdepim-3.5.9.new/knode/knnetaccess.cpp
--- kdepim-3.5.9/knode/knnetaccess.cpp 2005-11-08 19:33:31.000000000 -0300
+++ kdepim-3.5.9.new/knode/knnetaccess.cpp 2008-03-21 13:55:55.000000000 -0300
@@ -70,6 +70,7 @@
disconnect(nntpNotifier, SIGNAL(activated(int)), this, SLOT(slotThreadSignal(int)));
nntpClient->terminateClient();
+ triggerAsyncThread(nntpOutPipe[1]);
nntpClient->wait();
delete nntpClient;
diff -Nru -x Makefile.in kdepim-3.5.9/knode/knprotocolclient.cpp kdepim-3.5.9.new/knode/knprotocolclient.cpp
--- kdepim-3.5.9/knode/knprotocolclient.cpp 2005-09-10 04:24:04.000000000 -0400
+++ kdepim-3.5.9.new/knode/knprotocolclient.cpp 2008-03-21 14:03:24.000000000 -0300
@@ -93,7 +93,6 @@
timeval tv;
int selectRet;
- int holdTime = 1000 * account.hold();
while (true) {
if (isConnected()) { // we are connected, hold the connection for xx secs
FD_ZERO(&fdsR);
@@ -101,24 +100,21 @@
FD_SET(tcpSocket, &fdsR);
FD_ZERO(&fdsE);
FD_SET(tcpSocket, &fdsE);
- tv.tv_sec = 0;
- tv.tv_usec = 1000;
- --holdTime;
+ tv.tv_sec = account.hold();
+ tv.tv_usec = 0;
selectRet = KSocks::self()->select(FD_SETSIZE, &fdsR, NULL, &fdsE, &tv);
+ if ( mTerminate ) {
+ clearPipe();
+ closeConnection();
+ return;
+ }
+ // In addition to the timeout, this will also happen
+ // if select() returns early because of a signal
if (selectRet == 0) {
- if (holdTime <= 0) {
#ifndef NDEBUG
qDebug("knode: KNProtocolClient::waitForWork(): hold time elapsed, closing connection.");
#endif
closeConnection(); // nothing happend...
- holdTime = 1000 * account.hold();
- } else {
- if ( mTerminate ) {
- closeConnection();
- return;
- }
- continue;
- }
} else {
if (((selectRet > 0)&&(!FD_ISSET(fdPipeIn,&fdsR)))||(selectRet == -1)) {
#ifndef NDEBUG
@@ -129,18 +125,16 @@
}
}
- struct timeval timeout;
do {
- timeout.tv_sec = 0;
- timeout.tv_usec = 1000;
FD_ZERO(&fdsR);
FD_SET(fdPipeIn, &fdsR);
- if (mTerminate)
- return;
- } while (select(FD_SETSIZE, &fdsR, NULL, NULL, &timeout) <= 0); // don't get tricked by signals
+ } while (select(FD_SETSIZE, &fdsR, NULL, NULL, NULL) <= 0); // don't get tricked by signals
clearPipe(); // remove start signal
+ if (mTerminate)
+ return;
+
timer.start();
sendSignal(TSjobStarted);
Reply to: