httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Cantu <rica...@smartcsc.com>
Subject Re: mod_fcgid
Date Tue, 22 Sep 2009 23:21:36 GMT
On Tuesday 22 September 2009 3:04:46 pm Jeff Trawick wrote:
> On Tue, Sep 22, 2009 at 4:50 PM, Ricardo Cantu <ricardo@smartcsc.com> wrote:
> > Okay, got it all compiled and working.  I've stressed here and there and
> > seems
> > that it is running great! I see a little performance boost over the
> > mod_fastcgi module as well.
> >
> > So far the only issue I've come across is when my C program is exited it
> > leaves a zombie process for a couple of seconds then get's cleaned up.
> > Log confirms this as well;
> >
> > [Tue Sep 22 14:40:57 2009] [notice] mod_fcgid: process
> > /var/www/html/engine/bin/engine_10(12453) exit(normal exit), terminated
> > by calling exit(), return code: 0
> > [Tue Sep 22 14:40:57 2009] [warn] mod_fcgid: cleanup zombie process 12453
> >
> > Is this normal? or is there a directive that would help it exit cleaner?
> 
> Set FCGIDZombieScanInterval, which defaults to 3 seconds, down to 1.  But
> note that it may not scan for zombies every second because of this <=
> comparison:
> 
>     /* Should I check zombie processes in idle list now? */
>     if (procmgr_must_exit()
> 
>         || apr_time_sec(now) - apr_time_sec(lastzombiescan) <=
> 
>         sconf->zombie_scan_interval)
>         return;
> 
> Maybe set it to zero to mean 1 second ;)  It doesn't currently complain
> about a setting of 0.
> 
> (It would be nice not to have to scan for zombies at a set interval.  The
> process manager could be awakened when a subprocess exits, at least on
> Unix.)
> 

Okay, so this looks like the place to register some type of "wake up" callback 
on exit.

fcgid_proc_unix.c

apr_status_t
proc_spawn_process(char *lpszwapper, fcgid_proc_info * procinfo,
                   fcgid_procnode * procnode)
.
.
.
    /* Unlink it when process exit */
    if (ap_unixd_config.suexec_enabled) {
        apr_pool_cleanup_register(procnode->proc_pool,
                                  procnode, socket_file_cleanup,
                                  exec_setuid_cleanup);
    } else {
        apr_pool_cleanup_register(procnode->proc_pool,
                                  procnode, socket_file_cleanup,
                                  apr_pool_cleanup_null);
    }
.
.
.

And this is what we would want to wake up:

fcgid_pm_main.c

apr_status_t pm_main(server_rec * main_server, apr_pool_t * configpool)
{
.
.
        /* Wait for command */
        if (procmgr_peek_cmd(&command, main_server) == APR_SUCCESS) {
            if (is_spawn_allowed(main_server, &command))
                fastcgi_spawn(&command, main_server, configpool);

            procmgr_finish_notify(main_server);
        }
.
.
.

What you think?



Mime
View raw message