You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Justin Erenkrantz <je...@ebuilt.com> on 2001/10/26 23:13:49 UTC

mod_cgid broken in HEAD...

I'm getting "Premature End of Script Headers" in mod_cgid with 
revision 1.51 of apr/threadproc/unix/proc.c.  Reverting it to 
1.50 seems to make it okay over here.

I'm seeing APR_EOF when trying to read from the socket in the
httpd (non-cgid) process.  Jeff?  -- justin

<Log for 1.51>
apr_proc_create():
do exec cleanup before duping pipes to fds 0-2; otherwise,
any files cleaned up with those fds will hose our pipes;
typical symptom is APR_EOF in the parent when trying to read
child output
</Log>

<Diff>
===================================================================
RCS file: /home/cvspublic/apr/threadproc/unix/proc.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- apr/threadproc/unix/proc.c	2001/10/23 17:30:08	1.50
+++ apr/threadproc/unix/proc.c	2001/10/26 18:13:02	1.51
@@ -289,6 +289,12 @@
     else if (new->pid == 0) { 
         int status;
         /* child process */
+
+        /* do exec cleanup before duping pipes to fds 0-2; otherwise,
+         * any files cleaned up with those fds will hose our pipes
+         */
+        apr_pool_cleanup_for_exec();
+
         if (attr->child_in) {
             apr_file_close(attr->parent_in);
             dup2(attr->child_in->filedes, STDIN_FILENO);
@@ -312,8 +318,6 @@
                 exit(-1);   /* We have big problems, the child should exit. */
             }
         }
-
-        apr_pool_cleanup_for_exec();
 
         if ((status = limit_proc(attr)) != APR_SUCCESS) {
             return status;
</Diff>


Re: mod_cgid broken in HEAD...

Posted by Jeff Trawick <tr...@attglobal.net>.
Justin Erenkrantz <je...@ebuilt.com> writes:

> I'm getting "Premature End of Script Headers" in mod_cgid with 
> revision 1.51 of apr/threadproc/unix/proc.c.  Reverting it to 
> 1.50 seems to make it okay over here.
> 
> I'm seeing APR_EOF when trying to read from the socket in the
> httpd (non-cgid) process.  Jeff?  -- justin

I'll look for a fix this evening or just back out my change if I can't
figure out how to keep mod_cgid and my module happy.  If I haven't
done anything by Saturday morning in any US time zone, feel free to
back out.  If anybody wants to tag, feel free to back out.  I've
already started getting e-mails from cron jobs for the cgid breakage
so it won't stay broken for long.

I guess that cleanup_for_exec() is cleaning up the pipes explicitly
created by mod_cgid?  Not sure.

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: mod_cgid broken in HEAD...

Posted by Jeff Trawick <tr...@attglobal.net>.
Justin Erenkrantz <je...@ebuilt.com> writes:

> I'm getting "Premature End of Script Headers" in mod_cgid with 
> revision 1.51 of apr/threadproc/unix/proc.c.  Reverting it to 
> 1.50 seems to make it okay over here.
> 
> I'm seeing APR_EOF when trying to read from the socket in the
> httpd (non-cgid) process.  Jeff?  -- justin

I'll look for a fix this evening or just back out my change if I can't
figure out how to keep mod_cgid and my module happy.  If I haven't
done anything by Saturday morning in any US time zone, feel free to
back out.  If anybody wants to tag, feel free to back out.  I've
already started getting e-mails from cron jobs for the cgid breakage
so it won't stay broken for long.

I guess that cleanup_for_exec() is cleaning up the pipes explicitly
created by mod_cgid?  Not sure.

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...