From 8fe24d1f1bfc887045cedff7d2e01a316a3c8d2a Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Thu, 29 Mar 2001 00:17:50 +0000 Subject: [PATCH] Fix a storage leak in mod_cgid... the temporary pool created for each request was not cleaned up. This removes the nastiest symptom of some excess pipes being created (i.e., we don't run out of file descriptors), though something additional is needed to keep from creating the pipes to begin with. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88611 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ modules/generators/mod_cgid.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 548a94b70a..83a68381ca 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,9 @@ Changes with Apache 2.0.16-dev + + *) Clean up mod_cgid's temporary request pool. Besides fixing a + storage leak this ensures that some unnecessary pipes are closed. + [Jeff Trawick] + *) Performance: Add quick_handler hook. This hook is called at the very beginning of the request processing before location_walk, translate_name, etc. This hook is useful for URI keyed content diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 56a7acccff..967d7979f4 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -505,7 +505,6 @@ static int cgid_server(void *data) apr_proc_t *procnew = NULL; apr_file_t *inout; - len = sizeof(unix_addr); sd2 = accept(sd, (struct sockaddr *)&unix_addr, &len); if (sd2 < 0) { @@ -539,6 +538,10 @@ static int cgid_server(void *data) in_pipe, out_pipe, err_pipe)) != APR_SUCCESS) || + /* XXX apr_procattr_child_*_set() is creating an unnecessary + * pipe between this process and the child being created... + * It is cleaned up with the temporary pool for this request. + */ ((rc = apr_procattr_child_err_set(procattr, r->server->error_log, NULL)) != APR_SUCCESS) || ((rc = apr_procattr_child_in_set(procattr, inout, NULL)) != APR_SUCCESS))) || ((rc = apr_procattr_child_out_set(procattr, inout, NULL)) != APR_SUCCESS) || @@ -571,6 +574,7 @@ static int cgid_server(void *data) "couldn't create child process: %d: %s", rc, r->filename); } } + apr_pool_clear(p); } return -1; } -- 2.40.0