On Mon, Apr 26, 2010 at 11:02 AM, Weedy <weedy2...@gmail.com> wrote:
> Can the SIGTERM be logged? Just to see how long it takes?

The patches attached add extra logging to the error scan.

1. report_graceful_terminations.txt

It logs the number of processes receiving SIGTERM every time the error
scan runs, as long as there is at least one process.  This could
probably be committed permanently.

It requires LogLevel debug.

2. noisily_report_graceful_terminations.txt

This logs the pid of every process that is sent SIGTERM.  It is too
noisy to be committed permanently.

It requires LogLevel debug.
Index: modules/fcgid/fcgid_pm_main.c
===================================================================
--- modules/fcgid/fcgid_pm_main.c       (revision 938085)
+++ modules/fcgid/fcgid_pm_main.c       (working copy)
@@ -282,6 +282,7 @@
     fcgid_server_conf *sconf =
         ap_get_module_config(main_server->module_config,
                              &fcgid_module);
+    int graceful_terminations = 0;
 
     /* Should I check the busy list? */
     if (procmgr_must_exit()
@@ -326,6 +327,7 @@
                               current_node->proc_pool);
         if (!dummy) {
             proc_kill_gracefully(current_node, main_server);
+            ++graceful_terminations;
             apr_pool_userdata_set("set", HAS_GRACEFUL_KILL,
                                   apr_pool_cleanup_null,
                                   current_node->proc_pool);
@@ -350,6 +352,12 @@
     }
     previous_node->next_index = temp_error_header.next_index;
     proctable_pm_unlock(main_server);
+
+    if (graceful_terminations) {
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
+                     "mod_fcgid: gracefully terminated %d processes",
+                     graceful_terminations);
+    }
 }
 
 static void kill_all_subprocess(server_rec * main_server)
Index: modules/fcgid/fcgid_pm_main.c
===================================================================
--- modules/fcgid/fcgid_pm_main.c       (revision 938091)
+++ modules/fcgid/fcgid_pm_main.c       (working copy)
@@ -326,6 +326,9 @@
                               current_node->proc_pool);
         if (!dummy) {
             proc_kill_gracefully(current_node, main_server);
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
+                         "mod_fcgid: gracefully killing process %" 
APR_PID_T_FMT,
+                         current_node->proc_id.pid);
             apr_pool_userdata_set("set", HAS_GRACEFUL_KILL,
                                   apr_pool_cleanup_null,
                                   current_node->proc_pool);

Reply via email to