[erlang-questions] Problems stop/attach a release

Khitai Pang khitai.pang@REDACTED
Mon Mar 21 20:00:12 CET 2016


On 2016/3/21 21:42, Fred Hebert wrote:
> On 03/21, Khitai Pang wrote:
>> No, I have no erlang:set_cookie/2 in my code.  Now the app gets 
>> cookie from vm.args (-setcookie).
>>
>> I do have another problem though, if I remove -setcookie from the 
>> vm.args and rebuild the release, the built release can't start.  I 
>> don't understand why.
>>
> Relx uses nodetools, and nodetools seems to want a cookie real bad to 
> avoid different apps communicating each other accidentally.
>
> If the issue isn't related to cookies, it may be due to the app 
> hierarchy itself.
>
> In some cases, applications do not get proper dependency lists (which 
> app depends on which apps), or omit to include apps like 'stdlib' and 
> 'kernel'.
>
> In such cases, what may happen is that when shutting down, the Erlang 
> node tears down 'kernel' or 'stdlib' before some other running 
> application. Then the node is stuck in that mode where it is 
> technically still running, but no functions may be called and it just 
> doesn't ever shut down. When you get to that point, forcefully killing 
> the node is the only thing I know how to make work.
>
> The sad part is that any single dependency you include in your release 
> may be to blame for this.
>
> No idea if this is specifically your problem, but it's one I've seen 
> before.

I tried building (erlang.mk calling relx) the release with and without 
-setcookie in vm.args, and diff the result:


diff -Nurp _rel.good/myapp/releases/1/myapp.script 
_rel.bad/myapp/releases/1/myapp.script
--- _rel.good/myapp/releases/1/myapp.script     2016-03-22 
02:53:10.486533796
+++ _rel.bad/myapp/releases/1/myapp.script      2016-03-22 
02:54:04.983822959
@@ -1,4 +1,4 @@
-%% script generated at {2016,3,22} {2,53,10}
+%% script generated at {2016,3,22} {2,54,4}
  {script,
      {"myapp","1"},
      [{preLoaded,
diff -Nurp _rel.good/myapp/releases/1/vm.args 
_rel.bad/myapp/releases/1/vm.args
--- _rel.good/myapp/releases/1/vm.args  2016-03-22 02:52:57.000000000
+++ _rel.bad/myapp/releases/1/vm.args   2016-03-22 02:54:01.000000000
@@ -2,6 +2,6 @@
  -name myapp

  ## Cookie for distributed erlang
--setcookie f3IfFpeiI6n0JNhR6cGP
+#-setcookie f3IfFpeiI6n0JNhR6cGP

  -smp enable


The only difference is the vm.args file.  It seems that the script 
_rel/myapp/bin/myapp just won't work if there's no -setcookie in vm.args.


Thanks
Khitai



More information about the erlang-questions mailing list