[erlang-questions] Issues with reltool vs. init:stop()
Frédéric Trottier-Hébert
fred.hebert@REDACTED
Wed Jun 29 01:50:04 CEST 2011
Let me close this by calling it 'RESOLVED'.
I've found the time to analyse the scripts returned for both systools and reltool. It turns out that systools, no matter what dependencies you insert, will pretty much always start stdlib and kernel as part of the system (and primLoads them).
Reltool will do that, but for ALL applications in your release. This means that if you forget to make your app depend on stdlib (which was my case, because I'm dumb), it's loaded alright, but I'm guessing that a node will be taken down by removing stdlib before your own app, and then everything stalls. As soon as I made my apps depend on stdlib, things went fine.
The more you know.
--
Fred Hébert
http://www.erlang-solutions.com
On 2011-06-28, at 12:25 PM, Frédéric Trottier-Hébert wrote:
> For anyone interested in playing with the source, I've uploaded it to http://ferd.ca/release.zip
>
> Just starting the release should be enough to get it going and printing some results. The init:stop/0 call takes place in erlcount-1.0/src/erlcount_dispatch.erl. The app itself is explained in details at http://learnyousomeerlang.com/the-count-of-applications
>
> I'm getting a bit lost trying to find causes and solutions for that issue. I haven't yet dug into reltool's code nor have I checked that the boot/rel scripts have similar instructions, but I guess this will be the next step if nobody's ever had that problem before me.
>
> Cheers,
> --
> Fred Hébert
> http://www.erlang-solutions.com
>
>
>
> On 2011-06-28, at 07:56 AM, Frédéric Trottier-Hébert wrote:
>
>> I'm having quite peculiar issues when it comes to shutting down the VM from within a release.
>>
>> I'm writing a little demo application to play with reltools. The application is using files from LYSE's last chapters on applications, but I believe my problem to be independent from there. I've modified my code a bit so that when it's done running, 'init:stop()' is called from within one of the gen_servers I have. Whenever I do "application:start(ppool), application:start(erlcount)." and wait, the erlcount application will run, call init:stop(), and everything will shut down fine.
>>
>> I then made a release (.rel file not included here) with systools:
>>
>> systools:make_script("erlcount-1.0", [local]).
>> systools:make_tar("erlcount-1.0", [{erts,"/local/lib/erlang"}])
>>
>> And ran it with
>>
>> $ ./erts-5.8.4/bin/erl -boot ./releases/1.0.0/start
>>
>> from the right directory, which worked well. Init:stop() managed to take the VM down.
>>
>> Then I decided to switch to reltool. This is my current config file (not yet having all modules stripped down):
>>
>> {sys, [
>> {lib_dirs, ["/home/ferd/code/learn-you-some-erlang/release/"]},
>> {rel, "erlcount", "1.0.0", [kernel, stdlib, {ppool, permanent}, {erlcount, permanent}]},
>> {boot_rel, "erlcount"},
>> {relocatable, true},
>> {profile, standalone},
>> {app, ppool, [{vsn, "1.0.0"}, {app_file, all}, {debug_info, keep}]},
>> {app, erlcount, [{vsn, "1.0.0"}, {incl_cond, include}, {app_file, strip}, {debug_info, strip}]}
>> ]}.
>>
>> I then run the following commands, without an error:
>>
>> 1> {ok, Conf} = file:consult("erlcount-1.0.config").
>> 2> {ok, Spec} = reltool:get_target_spec(Conf).
>> 3> reltool:eval_target_spec(Spec, code:root_dir(), "./rel").
>>
>> Then, when I call "./rel/bin/erl" from the shell, the application starts normally, does everything it needs to do, but init:stop() will hang forever and the VM will only stop if I start it with -shutdown_timeout SomeDelay that will kill everything.
>>
>> The same problem remains if I make a more stripped-down reltools release by using incl_cond on the apps I want to only keep the core of what's necessary.
>>
>> I've googled around a bit and have not found anything that might explain this behaviour. My application's code doesn't seem to be the culprit given it works normally from the shell, and also works normally with systools, but fails to quit with reltools. I've also tried calling './rel/bin/erl -run init stop' -- it seems that it kills part of the VM's apps (no output coming, or only partial output from the app), but will still fail to take the whole VM down.
>>
>> Anyone has an idea or has had similar problems? Pointers or idea of what to explore to resolve this? I've tried it both with R14B02 and R14B03 and it keeps the same behaviour there. Reltool seems to break init:stop for my release.
>>
>> --
>> Fred Hébert
>> http://www.erlang-solutions.com
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list