kill broken cgi processes as soon as possible

Fri, 24 May 2024 12:57:34 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 24 May 2024 12:57:34 +0200
changeset 524
9f1d30988231
parent 523
a37c3099b29d
child 525
072d7794bcca

kill broken cgi processes as soon as possible

src/server/safs/cgi.c file | annotate | diff | comparison | revisions
--- a/src/server/safs/cgi.c	Fri May 24 09:22:38 2024 +0200
+++ b/src/server/safs/cgi.c	Fri May 24 12:57:34 2024 +0200
@@ -569,6 +569,11 @@
     
     handler->debug_finished = TRUE;
     
+    if(handler->result == REQ_ABORTED && handler->process.pid != 0) {
+        log_ereport(LOG_FAILURE, "cgi-send: kill script: %s", handler->path);
+        killpg(handler->process.pid, SIGTERM);
+    }
+    
     if(--handler->events > 0) {
         return 0;
     }
@@ -607,11 +612,6 @@
     }
     */
     
-    if(handler->result == REQ_ABORTED && handler->process.pid != 0) {
-        log_ereport(LOG_FAILURE, "cgi-send: kill script: %s", handler->path);
-        killpg(handler->process.pid, SIGTERM);
-    }
-    
     log_ereport(LOG_DEBUG, "cgi-send: req: %p cgi_close", rq);
     
     int exit_code = cgi_close(&handler->process);

mercurial