httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject PR #1523 in apache-bugs (fwd)
Date Sun, 07 Dec 1997 19:33:58 GMT

---------- Forwarded message ----------
Date: Sun, 07 Dec 1997 20:00:57 +0100
From: Peter Tillemans <pti@mail.net4all.be>
To: apache-bugs@apache.org
Cc: fer@elex.be, mdm@elex.be, bge@elex.be
Subject: PR #1523 in apache-bugs

Hello,

Sorry for bothering you like this, but I think I solved the PR #1523 which
I submitted saturday. 

Apparently a temporary copy of the standard files were made before spawning
a script. These temporary copies were not destraoyed after reassigning them
to the standard files, causing a leak of 3 filehandles each time a CGI
script is called.

>From line 1618 I added the lines marked with a +. I can now run scripts
over 50000 times without stopping serving CGI scripts. Before it stopped
serving scripts after 680 times : it ran out of filehandles. 

	/* restore the original stdin, stdout and stderr */
	if (pipe_in)
	    dup2(hStdIn, fileno(stdin));
	if (pipe_out)
	    dup2(hStdOut, fileno(stdout));
	if (pipe_err)
	    dup2(hStdErr, fileno(stderr));

+	/* PTI : Close duplicate copy of original stdin, stdout and stderr */
+	if (pipe_in)
+	    close(hStdIn);
+	if (pipe_out)
+	    close(hStdOut);
+	if (pipe_err)
+	    close(hStdErr);

        if (pid) {
	    note_subprocess(p, pid, kill_how);
	    if (pipe_in) {
		*pipe_in = in_fds[1];
	    }
	    if (pipe_out) {
		*pipe_out = out_fds[0];
	    }
	    if (pipe_err) {
		*pipe_err = err_fds[0];
	    }


A further indication that this fixed the problem is that the execution time
of the scripts stays the same now. It used to increase slowly till all the
filehandles were consumed.

Sorry I could not use the usual channels : I never received a confirmation
email (or MS Outlook Express misplaced it AGAIN) to reply on. And the
newsserver of my ISP is down (AGAIN :-( ).

regards,

Peter Tillemans 


Mime
View raw message