[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: FW: svn_io_run_cmd running out of file handles, APR bug?

From: Justin Erenkrantz <jerenkrantz_at_ebuilt.com>
Date: 2002-01-23 08:08:28 CET

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;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:58 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.