Can't run two remote tasks at the same time against a release node
elbrujohalcon opened this issue · 2 comments
Steps to reproduce
The steps to reproduce this bug are:
- Build a release with distillery (let's say we built one for
my_app
). - Start the release (e.g.
_build/dev/rel/my_app/bin/my_app console_clean
). - On another terminal open an rpc that takes a while (e.g.
build/my_app/bin/my_app rpc "Process.sleep(10000)
). - Try to do something else like that from a different terminal (e.g.
build/my_app/bin/my_app ping
).
At this point, you should see your ping
crashing with a message like …
▸ Could not start distribution: {{:shutdown, {:failed_to_start_child, :net_kernel, {:EXIT, :nodistribution}}}, {:child, :undefined, :net_sup_dynamic, {:erl_distribution, :start_link, [[:"my_app_maint_@127.0.0.1", :longnames], false]}, :permanent, 1000, :supervisor, [:erl_distribution]}}
Description of issue
- What are the expected results?
- You should be able to run as many remote commands as you want
- What version of Distillery?
- 2.0
Associated code
I was able to track down the issue to Mix.Releases.Runtime.Control.suffix_name/1,2
, where a hardcoded name is assigned to maintenance nodes.
I've added support for passing a flag --id=<string with valid node name chars>
to all of the release commands which take --name
and --cookie
; you can use this to uniquely identify tasks for multiple concurrent connections.
The reason I didn't autogenerate IDs is because node names are atoms, and when connecting to a node those atoms end up in both atom tables, after enough time of your tasks running, a node could blow the atom table limit, so it is better to decide on names per-task, so that those names are re-used each time that task runs.
Cool. Thanks :)