[erlang-patches] Supervisor transient workers restart strategy fix

Ulf Wiger ulf.wiger@REDACTED
Tue Nov 9 22:05:29 CET 2010


Hmm, interesting... :)

The documentation for 'supervisor' says:

"...a transient child process should be restarted only if it 
terminates abnormally, i.e. with another exit reason than normal."

OTOH, the code has violated* this description at least since R6C-0.

Perhaps the documentation should be changed then?

But what is the principle implemented exactly? The way it currently works,
a child that explicitly exits with reason shutdown (presumably signaling that
it doesn't want to restart), it  _will_ be restarted if the supervisor is configured 
for 'permanent' supervision of the child, but not if it's 'transient' supervision.

I think this feels wrong and unnecessary, but respect the reluctance to break
important code. Perhaps mnesia could be changed so as not to rely on this 
behaviour, and the supervisor module be corrected after that?

So far, the documented principle in Erlang has been that there is exit(normal),
and abnormal exits. The main use of the 'shutdown' convention has been 
(in my mind) to differentiate between a clean coordinated shutdown, and one 
where the client tried to do something (perhaps important) but failed.

* Strictly speaking, it doesn't violate it, since it doesn't say "if and only if".

BR,
Ulf W

On 9 Nov 2010, at 07:09, Björn Gustavsson wrote:

> 2010/10/29 Björn Gustavsson <bgustavsson@REDACTED>:
>> On Fri, Oct 29, 2010 at 1:19 PM, Michal Ptaszek
>> <michal.ptaszek@REDACTED> wrote:
>>> Hi,
>>> 
>>> we have found the following inconsistency in the supervisor.erl code:
>>> when supervisor's child restart strategy is set to transient and the child exits with reason shutdown, it is never restarted.
>>> 
>>> The patches include fix for the issue and the test suite used for reproducing the error, and later, after patching, for verifying the correctness of the code.
>>> 
>>> The patches are available here:
>>> git fetch git@REDACTED:paulgray/otp.git
>>> supervisor_transient_children_fix
>> 
>> Thanks! Will include in pu.
> 
> This change breaks mnesia (27 test cases fail).
> 
> While it might be possible to update mnesia to
> cope with this change, we suspect that other
> applications could break as well.
> 
> Therefore, the patch has been rejected and
> will be taken out of of pu.
> 
> -- 
> Björn Gustavsson, Erlang/OTP, Ericsson AB
> 
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
> 

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com





More information about the erlang-patches mailing list