Re: BUG: fatal interaction between application:ensure_all_started(A) and permit(B, false)
Ulf Wiger <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CADPRLo_yDY+P9D5Mb4eBWZy8YhESyWoyoPYaa6r0D9_nDiH4Ww@mail.gmail.com> |
Ah, so yet another bug! :) I guess this how you know that a feature hasn't really been used much. BR, Ulf W Den fre 26 mars 2021 17:06Martin Björklund <[email protected]> skrev: > Ulf Wiger <[email protected]> wrote: > > Permissions are a bit tricky. :) > > Indeed. This discussion prompted me to use permissions for a use case > of my own, but the system behaved really strange. Eventually I found > the problem. Have a look at this: > > Eshell V11.1.4 (abort with ^G) > 1> application:load(sasl). > ok > 2> application:permit(sasl, false). > ok > 3> application:start(sasl). > ok > 4> application:permit(sasl, true). > ok > 5> application:which_applications(). > [{sasl,"SASL CXC 138 11","4.0.1"}, > {stdlib,"ERTS CXC 138 10","3.14"}, > {kernel,"ERTS CXC 138 10","7.2"}] > > > This is fine and as expected. But now let's throw in an additional > permit false: > > > Eshell V11.1.4 (abort with ^G) > 1> application:load(sasl). > ok > 2> application:permit(sasl, false). > ok > 3> application:start(sasl). > ok > 4> application:permit(sasl, false). % <-- HERE > ok > 5> application:permit(sasl, true). > ok > 6> application:which_applications(). > [{stdlib,"ERTS CXC 138 10","3.14"}, > {kernel,"ERTS CXC 138 10","7.2"}] > > > Now sasl isn't started! > > It turns out that the second permit false will remove the > application from the start_p_false list in application_controller.erl: > > %% start requested but not started because permit was false > {false, {true, _Appl}, false, {value, _Tuple}, false, false} -> > update_permissions(AppName, Bool), > SS = S#state{start_p_false = keydelete(AppName, 1, SPF)}, > {reply, ok, SS}; > > This doesn't seem right. I think this should be a noop. > > > /martin >