apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject Re: FW: svn_io_run_cmd running out of file handles, APR bug?
Date Wed, 23 Jan 2002 07:08:28 GMT
On Sun, Jan 13, 2002 at 12:45:41PM +0100, Sander Striker wrote:
> Hi,
> 
> Anyone a direct idea of what is going on and if it is
> correct or not?

I'm thinking that the pipe code should be calling dup2 instead.
dup2 will close the old fd which is what I *believe* we want in
this code.  The pipe code will only cleanup what the apr_file_t
points at - not the original FDs that were called (we're changing
them by calling apr_procattr_child_*_set).

In SVN, I bet we will always be creating the pipes in 
apr_procattr_child_*_set when we enter that function, so the dup2 
*sounds* right - we want to close the old pipes we just created.
With mod_cgi, we call apr_procattr_io_set, so the pipes are
certainly created there first.

Can someone please test this and see if it fixes the problem?
I'm way too tired to test this myself (which also leads me to
believe that I may be 100% wrong...).  -- justin

Index: threadproc/unix/proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
retrieving revision 1.53
diff -u -r1.53 proc.c
--- threadproc/unix/proc.c	11 Nov 2001 05:51:00 -0000	1.53
+++ threadproc/unix/proc.c	23 Jan 2002 06:53:57 -0000
@@ -141,10 +141,10 @@
         apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->cntxt);
 
     if (child_in != NULL)
-        apr_file_dup(&attr->child_in, child_in, attr->cntxt);
+        apr_file_dup2(&attr->child_in, child_in, attr->cntxt);
 
     if (parent_in != NULL)
-        apr_file_dup(&attr->parent_in, parent_in, attr->cntxt);
+        apr_file_dup2(&attr->parent_in, parent_in, attr->cntxt);
 
     return APR_SUCCESS;
 }
@@ -157,10 +157,10 @@
         apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->cntxt);
 
     if (child_out != NULL)
-        apr_file_dup(&attr->child_out, child_out, attr->cntxt);
+        apr_file_dup2(&attr->child_out, child_out, attr->cntxt);
 
     if (parent_out != NULL)
-        apr_file_dup(&attr->parent_out, parent_out, attr->cntxt);
+        apr_file_dup2(&attr->parent_out, parent_out, attr->cntxt);
 
     return APR_SUCCESS;
 }
@@ -173,10 +173,10 @@
         apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->cntxt);
 
     if (child_err != NULL)
-        apr_file_dup(&attr->child_err, child_err, attr->cntxt);
+        apr_file_dup2(&attr->child_err, child_err, attr->cntxt);
 
     if (parent_err != NULL)
-        apr_file_dup(&attr->parent_err, parent_err, attr->cntxt);
+        apr_file_dup2(&attr->parent_err, parent_err, attr->cntxt);
 
     return APR_SUCCESS;
 }


Mime
View raw message