When mod_fcgid 2.2 is used with Apache on Windows (Apache 2.2.8), it prevents 
Apache from performing 
a "graceful" restart.

mod_fcgid starts its "Process Manager" worker_thread and wakeup_thread in the 
function 
procmgr_post_config()

  file: arch/win32/fcgid_pm_win.c
  
http://mod-fcgid.cvs.sourceforge.net/*checkout*/mod-fcgid/mod_fcgid/arch/win32/fcgid_pm_win.c

It schedules an APR pool cleanup to stop these two threads in the 
procmgr_child_init() function.

This works in the Apache child process, but it causes problems in the Apache 
parent process.

The Apache parent process runs all configuration steps - so both threads are 
started in the parent 
process (although they don't so anything useful in this process).

The parent does not run child_init hooks, so there is no cleanup registered to 
stop these threads in 
the parent process.

When Apache is restarted (i.e. a "graceful" restart by Ctrl-Break in the Apache 
window, or setting 
the "ap{pid}_restart" event from a program) - these threads in the parent 
process are left running. 
  They cause an access violation once the mod_fcgid.so library is unloaded.

A solution is to register the pool cleanup against the configuration pool 
(pconf) immediately after 
these threads are launched in procmgr_post_config().  The procmgr_child_init() 
function can be 
eliminated.

This will make the worker_thread and wakeup_thread in the parent process get 
shut down correctly, 
allowing Apache to perform a "graceful" restart without access violations.

Regards,
-tom-



--- fcgid_pm_win.orig   2008-04-05 18:23:34.434024000 -0400
+++ fcgid_pm_win.c  2008-04-05 18:23:42.902672000 -0400
@@ -101,6 +101,9 @@
         exit(1);
     }

+   apr_pool_cleanup_register(pconf, main_server,
+                             procmgr_stop_procmgr, apr_pool_cleanup_null);
+
     return APR_SUCCESS;
  }

@@ -256,9 +259,6 @@
  apr_status_t
  procmgr_child_init(server_rec * main_server, apr_pool_t * pchild)
  {
-   apr_pool_cleanup_register(pchild, main_server,
-                             procmgr_stop_procmgr, apr_pool_cleanup_null);
-   return APR_SUCCESS;
  }

  int procmgr_must_exit()

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mod-fcgid-users mailing list
Mod-fcgid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users

Reply via email to