AE Fork Pool reaping problem

Michael Wright mjw at methodanalysis.com
Thu Apr 13 23:10:10 CEST 2017


Thanks for your comments Marc, appreciate it. I've conducted a series
of field tests since your suggestions.

> I think the best way to proceed for you in this specific case is to add
> this to your worker:
>
>    use Mojo::UserAgent; # atfer this line
>    BEGIN { $SIG{CHLD} = 'IGNORE' } # restore the SIGCHLD setting

My 'production' code is hugely more extensive than the example I
posted, but nevertheless much to my considerable amazement, this does
actually work without any apparent side effects.

> A safer way would be to declare Mojo::UserAgent not fork-safe and load it
> only in "sub init", which increases memory consumption and worker startup
> time, which might or might not be an issue for you.

This works, and I much prefer it for the safety, the only real problem
that I care about is, as you noted, the memory footprint increases.
The increase is 70% for my use case, and I can sort of live with this,
it's just a bit of a shame. Ultimately it just means 70% more servers
to achieve the same work rate.

Thanks for your help.



More information about the anyevent mailing list