apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Lotspeich <e...@lotspeich.org>
Subject Bug in apr_pools.c: patch
Date Sun, 25 Nov 2007 07:17:31 GMT
Hi:

I continued my investigation as to the reason why apr_pool_note_subprocess() 
is not working for me.  It seems that there is a bug in apr_pools.c in the 
function free_proc_chain().  Here's my patch:

 --- apr_pools.c 2007-11-24 23:06:12.000000000 -0800
+++ apr_pools.c+        2007-11-24 23:06:01.000000000 -0800
@@ -2118,7 +2118,7 @@
 #ifndef NEED_WAITPID
     /* Pick up all defunct processes */
     for (pc = procs; pc; pc = pc->next) {
-        if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) != 
APR_CHILD_NOTDONE)
+        if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) == 
APR_CHILD_DONE)
             pc->kill_how = APR_KILL_NEVER;
     }
 #endif /* !defined(NEED_WAITPID) */

It may be true that apr_proc_wait is the original source of the problem.  In 
theory, both the previous and patched versions of the code above are 
equivalent.  In reality, the doxygen documentation is incomplete.  
apr_proc_wait can return codes other than APR_CHILD_DONE and 
APR_CHILD_NOTDONE.  In my case, the process I to be checked was actually 
running, but an APR_CHILD_NOTDONE code wasn't being set!

Any questions or comments would be appreciated.

Regards,

Erik.

Mime
View raw message