From dc5348e928deae1564ca6622d72ba0d4dac8b80b Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 28 Aug 2010 19:31:03 +1200 Subject: [PATCH] Author: Stefan Fritsch 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/fs/ufs/store_io_ufs.cc b/src/fs/ufs/store_io_ufs.cc index 035e6935fa..35d9c597a5 100644 --- a/src/fs/ufs/store_io_ufs.cc +++ b/src/fs/ufs/store_io_ufs.cc @@ -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; -- 2.47.2