apr-dev mailing list archives

The other child API in APR is junk. The intent of most of the OC calls is
really fuzzy. I propose a rewrite of the OC routines...
Here is what we have today:
apr_proc_other_child_register()
apr_proc_other_child_unregister()
Register an OC and unregister an OC. These are the only OC functions that
make sense... continuing...
apr_proc_probe_writable_fds()
This function seems worthless and doesn;t appear to be used for anything.
You cannot make any meaningful diagnosis on an OC if the fds are not
writable. Perhaps the pipe is full, perhaps the process is dead, ???. No
way of knowing how to handle this case.
apr_proc_other_child_read(apr_proc_t *pid, int status)
Simply results in the call to *ocr->maintenance(APR_OC_REASON_DEATH, ...)
which is totally non-intuitive behaviour given the name of the funtion.
Presumably apr_proc_other_child_read is called after you discover a OC has
failed and that calling maintenance with APR_OC_REASON_DEATH is the right
thing to do. Presumably.
apr_proc_other_child_check()
Runs the list of OCs and checks to see if they are dead or alive and calls
*ocr->maintenance based on whether the OC is dead or alive. threaded.c calls
this routine multiple times during -shutdown-, after the process group has
been signaled to die. What are we checking and why? This is just goofy...
Straw man proposal...
1. apr_proc_other_child_*register()
Leave the register and unregister functions the same
2. apr_proc_other_child_check()
It makes sense to me to use this routine when you want OCs to stay up and
alive. You would call it during idle_server_maintenance and it would detect
when an OC has dies and call maintenance to restart it. The Unix
implementation of Apache HTTP would probably not use this routine as the MPM
parent processes use other mechanisms to detect child death. This would be
good for Windows to detect child death.
3. apr_proc_probe_writable_fds()
Remove it and all references to it.
4. apr_proc_other_child_shutdown()
Signals each OC to shutdown. When the OC has died, calls maintenance
reporting OC DEATH (rather than LOST, which would imply a restart)
5. apr_proc_other_child_maintenance(apr_proc_t *pid, action)
Perform specefic OC maintenance. If threaded.c detects that an OC has gone
down, it would call...
apr_proc_other_child_maintenance(apr_proct *pid, APR_OC_REASON_LOST) to
cause the appopriate maintenance routine to be called.
Thoughts?
Bill