[erlang-questions] Issues with reltool vs. init:stop()

Frédéric Trottier-Hébert fred.hebert@REDACTED
Tue Jun 28 13:56:55 CEST 2011


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






More information about the erlang-questions mailing list