On Wed, Nov 14, 2012 at 8:49 AM, Philip Martin
<[email protected]> wrote:
>...
> Having hooks run in a separate process is complicated.  The process
> would need to be multi-threaded, or multi-process, to avoid hooks
> running in serial.  stdin/out/err would need to be handled
> somehow. Pipes perhaps?  By passing file descriptors across a Unix
> domain socket?

We could do whatever mod_cgid is doing.

But with that said: most hooks don't generate stdout or stderr. We
could ship over parameters and a stdin blob, and run the hook. This
simplified model would only work if it was acceptable to *not* return
stdout/err to the client. (anything could still be logged on the
server)

You don't really need multiprocess or multithread, if you run an async
network loop such as serf does. The child exit signal would pop the
network loop, allowing for examination of the result. The daemon would
get a hook request, fork/exec, and return the exit code. (heck, if the
stdout/err is "small enough", it could be captured and returned in the
response)

IIRC, Apache httpd even has a subsystem to monitor these kinds of
daemons and keep them running.

Cheers,
-g

Reply via email to