You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Alistair Brown <al...@btinternet.com> on 2000/11/21 20:57:27 UTC

mod_perl/6877: fork in perl cgi script creates an extra server process

>Number:         6877
>Category:       mod_perl
>Synopsis:       fork in perl cgi script creates an extra server process
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Tue Nov 21 12:00:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     alistair.d.brown@btinternet.com
>Release:        1.3.4 (Unix)
>Organization:
apache
>Environment:
Suse Linux 6.1 using kernel 2.2.5#1 (Apache binaries installed as part of the distribution).  If you would like more specific information then let me know.
>Description:
Creating a Perl cgi script which does a fork causes an extra server process to be created every time that script is executed.  (Up to about 250 on my system, although MaxClients is set to 150).  However, this only occurs if the following lines are in the httpd.conf file (as they were by default):

# enable perl for cgi-bin
#

<Location /cgi-bin>
AddHandler perl-script .pl
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
</Location>

If those lines are commented out then my perl scripts still execute, but any server processes that are created terminate when my script terminates.
>How-To-Repeat:
Example (trivial) perl script:

#!/usr/bin/perl -w
$| = 1;
print "Content-type: text/html\n\n<html></html>";
close STDOUT;
if(fork)
{
   exit;
}
else
{
   close STDOUT;
   exit;
}

Install the script in the cgi-bin directory or sub-directory and execute from a web browser.  If the lines shown above are in the httpd.conf file an extra process should be created each time the script is run.
>Fix:
I am not entirely sure why the lines shown above are required in the httpd.conf file exist if perl scripts work with them omitted.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]