apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fritsch ...@sfritsch.de>
Subject File descriptor leak with mpm-event / apr file bucket cleanup
Date Mon, 17 May 2010 21:11:39 GMT
Hi,

in Wicklow, Rainer pointed out a problem with mpm event (in trunk): 
File descriptors from file buckets are not closed as soon as the file 
has been sent completely, but instead are only closed when the 
connection is closed.

The core output filter setasides the file buckets into the connection 
pool. The problem is that apr-util does not close the file when the 
bucket is destroyed, but instead depends on the pool being destroyed, 
too. I think this is a bug in apr-util. The patch below fixes the 
problem. Do you agree or should this somehow be fixed in the core 
output filter?

Of course, it is possible that some apr-util users depend on this 
strange behaviour.

Cheers,
Stefan

--- buckets/apr_buckets_file.c.dist +0200
+++ buckets/apr_buckets_file.c
@@ -34,8 +34,7 @@
     apr_bucket_file *f = data;
 
     if (apr_bucket_shared_destroy(f)) {
-        /* no need to close the file here; it will get
-         * done automatically when the pool gets cleaned up */
+        apr_file_close(f->fd);
         apr_bucket_free(f);
     }
 }

Mime
View raw message