[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [kdelibs/KDE/4.7] kio/kio: fd leak fix by Ambroz Bizjak:
From:       Ambroz Bizjak <ambrop7 () gmail ! com>
Date:       2011-08-18 18:36:57
Message-ID: CAOA3yKLk-2EcL7uOoYPWaJ1Wt6T=KRi76ngstF_6xvyi2mE2bA () mail ! gmail ! com
[Download RAW message or body]

I can't reproduce this. How much time did you have to wait? And it
looks like a problem with Konqueror or the client side of KIO, not the
slaves.
It would probably help to see why
SocketConnectionBackend::listenForRemote() is failing. I'm attaching a
patch to add some error messages.

On Thu, Aug 18, 2011 at 7:10 PM, David Faure <faure@kde.org> wrote:
> On Thursday 18 August 2011 02:25:16 Dawit A wrote:
>> David,
>
> Cc'ing Ambroz.
>
>> I do not understand the point of this patch. It seems to want to
>> delete all QObjects in the current process in order to fix a fd leak ?
>
> No, it doesn't delete all QObjects. Only those on which deleteLater() was
> called. The added code simply "flushes out" these deleteLater so that they
> actually happen.
>
>> Is that the intent ? If so, then there is a big big problem. After
>> this patch was committed Konqueror completely stops working for me
>> whenever I browse a given website, leave it alone for a long while,
>> and come back to browse the same site I was viewing earlier. After
>> that I cannot use that particular instance of Konqueror. I have to
>> launch a new one.
>
> Off hand I have no idea why this would happen. I'm afraid you or Ambroz will
> have to debug it. (e.g. by adding a qdebug in QObject::deleteLater to see
> which objects are being scheduled for deletion?)
>
>> I see the following error message in my .xsession-errors file:
>>
>> konqueror(18947)/kio (Slave) KIO::Slave::createSlave: createSlave
>> "https" for KUrl("<sensored>")
>> konqueror(18947) KIO::SlavePrivate::SlavePrivate: Connection server
>> not listening, could not connect
>> klauncher(5035)/kio (KLauncher) KLauncher::requestSlave: KLauncher:
>> launching new slave  "kio_http"  with protocol= "https"  args=
>> ("https", "local:/tmp/ksocket-dalemayehu/klauncherMT5035.slave-socket",
>> "")
>> klauncher(5035)/kio (KLauncher) KLauncher::processRequestReturn:
>> "kio_http" (pid 24120) up and running.
>> kio_http(24120)/kio (KIOConnection) KIO::Connection::connectToRemote:
>> Unknown requested KIO::Connection protocol=' "" ' ( "" )
>> kio_http(24120)/kio (kioslave) KIO::SlaveBase::connectSlave: failed to
>> connect to ""
>> Reason: ""
>> couldn't lock local file
>> konqueror(18947)/kio (Slave) KIO::Slave::timeout: slave failed to
>> connect to application pid= 24120  protocol= "https"
>> konqueror(18947)/kio (Slave) KIO::Slave::timeout: Houston, we lost our
>> slave, pid= 24120
>> konqueror(18947)/kio (Slave) KIO::Slave::timeout: slave died pid =  24120
>> konqueror(18947)/kio (AccessManager)
>> KDEPrivate::AccessManagerReply::jobError: " couldn't lock local file
>> couldn't lock local file
>> couldn't lock local file
>> couldn't lock local file
>> couldn't lock local file
>> couldn't lock local file
>>
>> Moreover, are not KIO::Scheduler and KLauncher the ones responsible
>> for managing ioslave creation/deletion ? BTW, reverting this patch
>> seems to solve the problem for me. I am still testing with longer wait
>> periods before using the browser again, but so far doing so seems to
>> have resolved the regression.
>>
>> On Wed, Aug 10, 2011 at 5:49 PM, David Faure <faure@kde.org> wrote:
>> > Git commit a889845bb441e6325df45e1c6d2263ac82358fbe by David Faure.
>> > Committed on 10/08/2011 at 02:30.
>> > Pushed by dfaure into branch 'KDE/4.7'.
>> >
>> > fd leak fix by Ambroz Bizjak: deleteLater has no effect w/o eventloop
>> >
>> > M  +7    -0    kio/kio/slavebase.cpp
>> >
>> > http://commits.kde.org/kdelibs/a889845bb441e6325df45e1c6d2263ac82358fbe
>> >
>> > diff --git a/kio/kio/slavebase.cpp b/kio/kio/slavebase.cpp
>> > index 221ef75..ccfc06d 100644
>> > --- a/kio/kio/slavebase.cpp
>> > +++ b/kio/kio/slavebase.cpp
>> > @@ -37,6 +37,7 @@
>> >  #include <QtCore/QFile>
>> >  #include <QtCore/QList>
>> >  #include <QtCore/QDateTime>
>> > +#include <QtCore/QCoreApplication>
>> >
>> >  #include <kcrash.h>
>> >  #include <kconfig.h>
>> > @@ -314,7 +315,13 @@ void SlaveBase::dispatchLoop()
>> >             kDebug(7019) << "slave was killed, returning";
>> >             return;
>> >         }
>> > +
>> > +        // execute deferred deletes
>> > +        QCoreApplication::sendPostedEvents(NULL,
>> > QEvent::DeferredDelete); }
>>
>> Do you really want to send a deferred delete request to all the
>> QObject's in the current process from within the while loop ?
>>
>> > +
>> > +    // execute deferred deletes
>> > +    QCoreApplication::sendPostedEvents(NULL, QEvent::DeferredDelete);
>> > }
> --
> David Faure, faure@kde.org, http://www.davidfaure.fr
> Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
>
>

["a.diff" (text/x-patch)]

diff --git a/kio/kio/connection.cpp b/kio/kio/connection.cpp
index d47d7d5..39ba95c 100644
--- a/kio/kio/connection.cpp
+++ b/kio/kio/connection.cpp
@@ -208,7 +208,9 @@ bool SocketConnectionBackend::listenForRemote()
         socketfile->setSuffix(QLatin1String(".slave-socket"));
         if (!socketfile->open())
         {
-            errorString = i18n("Unable to create io-slave: %1", strerror(errno));
+            int error = errno;
+            kDebug(7017) << "KTemporaryFile::open() failed: " << strerror(error);
+            errorString = i18n("Unable to create io-slave: %1", strerror(error));
             delete socketfile;
             return false;
         }
@@ -221,6 +223,7 @@ bool SocketConnectionBackend::listenForRemote()
 
         localServer = new KLocalSocketServer(this);
         if (!localServer->listen(sockname, KLocalSocket::UnixSocket)) {
+            kDebug(7017) << "KLocalSocketServer::listen() failed";
             errorString = localServer->errorString();
             delete localServer;
             return false;
@@ -240,6 +243,8 @@ bool SocketConnectionBackend::listenForRemote()
         connect(tcpServer, SIGNAL(newConnection()), SIGNAL(newConnection()));
     }
 
+    kDebug(7017) << "listen succeesed";
+
     state = Listening;
     return true;
 }
@@ -559,6 +564,7 @@ void ConnectionServer::listenForRemote()
     d->backend = new SocketConnectionBackend(SocketConnectionBackend::LocalSocketMode, this);
 #endif
     if (!d->backend->listenForRemote()) {
+        kDebug(7017) << "listenForRemote() failed: " << d->backend->errorString;
         delete d->backend;
         d->backend = 0;
         return;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic