You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2006/12/18 12:27:27 UTC

DO NOT REPLY [Bug 41199] New: - on cgi timeout, kill process group

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41199

           Summary: on cgi timeout, kill process group
           Product: Apache httpd-2
           Version: 2.0.52
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: mod_cgi
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: danny_milo@yahoo.com


Hi,

When the following happens in httpd 2.0.52,
- cgi is launched
- cgi launches a helper process
- helper process does stuff for a too long time
- apache httpd kills cgi process
then
- helper process still runs (I'd expect it to be dead, too)

Maybe it would make sense to kill the process group instead (using the cgi pgid)
(I'm not sure about all the implications). i. e. do:

This seems to be the same in the httpd 2.2.3 source I just downloaded and read:

mod_cgi.c:465 (in run_cgi_child) calls:
            apr_pool_note_subprocess(p, procnew, APR_KILL_AFTER_TIMEOUT);

srclib/apr/memory/unix/apr_pools.c:2136 (in free_proc_chain) calls:
            if (apr_proc_kill(pc->proc, SIGTERM) == APR_SUCCESS)

/srclib/apr/threadproc/unix/signals.c:48 (in apr_proc_kill) calls:
    if (kill(proc->pid, signum) == -1) {

Which means if there were any helper processes spawned by the cgi, they will
survive. Which I find strange...

kill() with a negated pid would kill the entire process group, which would be
preferrable.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41199] - on cgi timeout, kill process group

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41199





------- Additional Comments From danny_milo@yahoo.com  2006-12-19 06:05 -------
I'm open to suggestions how to do that in the CGI script.
The problem is that even when the CGI script does the setpgid on it's own,
apache will kill it using a positive pid and so it still doesn't do the right
thing then. Am I missing something obvious?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41199] - on cgi timeout, kill process group

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41199





------- Additional Comments From jorton@redhat.com  2006-12-19 06:30 -------
Trapping SIGTERM in your app and killing the process group from the signal
handler would seem like the obvious solution - any reason why that wouldn't work?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41199] - on cgi timeout, kill process group

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41199





------- Additional Comments From danny_milo@yahoo.com  2006-12-18 08:43 -------
Provided that the process group consists of the process tree branch descending
from the cgi process, of course.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41199] - on cgi timeout, kill process group

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41199


jorton@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From jorton@redhat.com  2006-12-18 09:03 -------
It doesn't, though, the CGI script will be in the process group created by the
httpd parent by default.  It's up to the CGI script to terminate however it sees
fit, there is no need for httpd to enforce a particular scheme here.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41199] - on cgi timeout, kill process group

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41199>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41199





------- Additional Comments From wrowe@apache.org  2006-12-19 09:05 -------
I agree with Joe here for the most part...

If the CGI is soft-terminated, the only portable behavior that you should ever
rely upon is trapping the signal and releasing your kids.

Think about it, if you Ctrl+C this script in testing, it leaves lingering child
processes?  That's the cgi's flaw!!!

NOW - if we kill (second chance) a CGI with a hard-kill, I agree with the 
submitor that we should do everything in our power to clean up; we clobbered the
process that stalled, we should clobber associated processes.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org