[erlang-bugs] Supervisor terminate_child race

Bryan Fink <>
Mon Apr 29 15:14:38 CEST 2013


Hi, Tim. Thanks for responding.

On Mon, Apr 29, 2013 at 6:08 AM, Tim Watson <> wrote:
> Would it be sufficient to add a clause explicitly handling `{'DOWN', MRef, process, Child, noproc}' to the receive block? As I understand it, monitor/2 works synchronously and the 'DOWN' message will be enqueued straight away if the target process is unknown. Or is that assumption unreliable - I'd like to know if it is - and there's more to it?

I don't think adding a DOWN-noproc clause to the receive block would
be sufficient. It would silence the error, but it would also end up
hiding legitimate errors about children that do actually exit with
reason noproc.

I believe I also now understand that monitoring (instead of depending
solely on the link) is necessary precisely because of those "naughty"
children. Child processes can't disable a monitor, as they can a link,
so depending on DOWN instead of EXIT prevents a child from causing the
supervisor to hang (as warned about in the doc of shutdown/2).

> Unfortunately I don't have an EQC/PULSE license to be able to test this. It'd be really nice if PULSE was available in the free/mini QC for selected open source projects.

Agreed. PULSE is a fantastic tool that has been invaluable to me the
past couple of weeks.

-Bryan


More information about the erlang-bugs mailing list