httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <>
Subject Re: mod_include vs file descriptors
Date Tue, 13 Nov 2001 08:52:25 GMT
Ryan Bloom wrote:


>>What else would break if we destroyed the subreq here,
>>even in the case of a nested include?
>Nothing _should_ break, but there are few potential problems.  The biggest one
>that I see is that you can't be sure that the data that has been allocated has 
>actually been sent to the client yet. This means that it would be possible to 
>free the sub-request, and have MMAP'ed data that gets destroyed before
>the client sees it.  If that is the case, then it is a bug that should be fixed,
>this leakage is not the solution however.

As a simpler solution, is there any reason why we can't close the
file descriptor when turning a file bucket into an mmap bucket?

Index: srclib/apr-util/buckets/apr_buckets_file.c
RCS file: /home/cvspublic/apr-util/buckets/apr_buckets_file.c,v
retrieving revision 1.57
diff -u -r1.57 apr_buckets_file.c
--- srclib/apr-util/buckets/apr_buckets_file.c    2001/11/12 03:22:25    
+++ srclib/apr-util/buckets/apr_buckets_file.c    2001/11/13 08:41:10
@@ -85,9 +85,9 @@
 static void file_destroy(void *data)
+    apr_bucket_file *a = (apr_bucket_file *)data;
+    apr_file_close(a->fd);
     if (apr_bucket_shared_destroy(data)) {
-        /* no need to close the file here; it will get
-         * done automatically when the pool gets cleaned up */

View raw message