]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Stefan Fritsch <sf@sfritsch.de>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 29 Aug 2010 00:52:30 +0000 (18:52 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 29 Aug 2010 00:52:30 +0000 (18:52 -0600)
Bug 2872: leaking file descriptors

As I understand it, the leak happens this way: A client request kicks off an
asynchronous file open request. If the client request is aborted and disappears
before the file open has completed, the file is never closed again. This
explains why this leak can only happen with aufs and not with ufs.

src/fs/ufs/store_io_ufs.cc

index 035e6935fa2ce11f00127e3145dc048a720bb247..35d9c597a53e17e11d8e9dfdb9bf0b19f228a1a6 100644 (file)
@@ -452,8 +452,14 @@ UFSStoreState::kickReadQueue()
 
     void *cbdata;
 
-    if (cbdataReferenceValidDone(q->callback_data, &cbdata))
+    if (cbdataReferenceValidDone(q->callback_data, &cbdata)) {
         read_(q->buf, q->size, q->offset, q->callback, cbdata);
+    }
+    else {
+        debugs(79, 2, "UFSStoreState::kickReadQueue: this: " << this << " cbdataReferenceValidDone returned false." << " closing: " << closing << " flags.try_closing: " << flags.try_closing);
+        delete q;
+        return false;
+    }
 
     delete q;