some questions about AnyEvent::Fork

Dietmar Maurer dietmar at proxmox.com
Fri Apr 19 06:46:50 CEST 2013


Hi all,

I have a simple prefork server where a master runs/forks 3 workers.

The workers itself can also fork to execute long running tasks, so
we have the following parent/child relationchip:

master ⇒ worker ⇒ task

The master is very simple and only listens to $SIG{CHILD}. It simply forks a new
worker if another one dies (to keep the number of workers constant).
 
The worker itself  is complex and uses AnyEvent, and I would also like to use AnyEvent inside
processes forked from workers (tasks).

This does not work currently, because we fork at random points (Event loop already in use).

>From what I see AnyEvent::Fork would solve the problem, but I do not really want to
allocate a 'TEMPLATE' process.

In our case we know that we can always fork the 'master', so there is no need to allocate
an additional Template.

Do you think we can modify AnyEvent::Fork to work without requiring a TEMPLATE?





More information about the anyevent mailing list