www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Shalayeff <mic...@openbsd.org>
Subject os-other/1654: fails to fork off a cgi
Date Mon, 12 Jan 1998 08:14:34 GMT

>Number:         1654
>Category:       os-other
>Synopsis:       fails to fork off a cgi
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Mon Jan 12 00:20:00 PST 1998
>Last-Modified:
>Originator:     mickey@openbsd.org
>Organization:
apache
>Release:        1.3b3
>Environment:
OpenBSD current as of 12/01/98
>Description:
n/a
>How-To-Repeat:
run apache for a busy site with a lot of cgi calls, hits and vhosts under
openbsd, experience 'unable to spaw child process' messages
>Fix:
--- ../../../1/apache_1.3b3/src/main/alloc.c    Wed Nov 12 18:22:05 1997
+++ alloc.c     Mon Jan 12 02:19:45 1998
@@ -1145,8 +1145,8 @@
 
 API_EXPORT(int) pclosesocket(pool *a, int sock)
 {
-    int res;
-    int save_errno;
+    register int res;
+    register int save_errno;
 
     block_alarms();
     res = closesocket(sock);
@@ -1214,7 +1214,7 @@
 
 API_EXPORT(void) note_subprocess(pool *a, int pid, enum kill_conditions how)
 {
-    struct process_chain *new =
+    register struct process_chain *new =
     (struct process_chain *) palloc(a, sizeof(struct process_chain));
 
     new->pid = pid;
@@ -1240,18 +1240,23 @@
                                enum kill_conditions kill_how,
                                int *pipe_in, int *pipe_out, int *pipe_err)
 {
-    int pid;
+    register int pid;
+    register int save_errno;
+    register int i;
     int in_fds[2];
     int out_fds[2];
     int err_fds[2];
-    int save_errno;
 
     if (pipe_in && os_pipe(in_fds) < 0) {
+       save_errno = errno;
+       aplog_error(APLOG_MARK, APLOG_ERR, NULL, "os_pipe(in_fds) failed");
+       errno = save_errno;
        return 0;
     }
 
     if (pipe_out && os_pipe(out_fds) < 0) {
        save_errno = errno;
+       aplog_error(APLOG_MARK, APLOG_ERR, NULL, "os_pipe(out_fds) failed");
        if (pipe_in) {
            close(in_fds[0]);
            close(in_fds[1]);
@@ -1262,6 +1267,7 @@
 
     if (pipe_err && os_pipe(err_fds) < 0) {
        save_errno = errno;
+       aplog_error(APLOG_MARK, APLOG_ERR, NULL, "os_pipe(err_fds) failed");
        if (pipe_in) {
            close(in_fds[0]);
            close(in_fds[1]);
@@ -1346,8 +1352,11 @@
     }
 #else
 
-    if ((pid = fork()) < 0) {
+    for (i = 10; (pid = fork()) < 0 && errno == EAGAIN && i--; usleep(10000));
+
+    if (pid < 0) {
        save_errno = errno;
+       aplog_error(APLOG_MARK, APLOG_ERR, NULL, "fork() failed");
        if (pipe_in) {
            close(in_fds[0]);
            close(in_fds[1]);
%0
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]




Mime
View raw message