Skip to content

Hartbeat from Loop to Dispatcher

Latest
Compare
Choose a tag to compare
@stephanschuler stephanschuler released this 21 Jun 09:38
da8f5aa

The LeadingDispatcher runs in the very parent, the Loop in the very
first child process spawned. Since proc_open wraps the actual loop
process in a "sh -c", the parent process id for the loop isn't the
PHP process calling the proc_open.

Sometimes when the parent PHP process gets killed, the "sh -c" just
gets reassigned to "another parent" -- usually the parent of the
process starting the dispatcher, leaving the relation between
dispatcher and loop unchanged in terms of process ids.

This means the loop needs another way of checking if the parent
still exists. For now I'm using another file descriptor where
the loop just pushes strings to the parent, which fails as soon
as the parent is gone.