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?
E.g.,
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
1.57
+++ 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 */
free(data);
}
}