bitwalker / swarm

Easy clustering, registration, and distribution of worker processes for Erlang/Elixir
MIT License
1.19k stars 102 forks source link

Argument Error on :ets.lookup, crash at startup #84

Closed tchoutri closed 6 years ago

tchoutri commented 6 years ago

Hi @bitwalker I'm having this error all of a sudden. I can't really figure out from where it comes, but I know that it only occurs when using Distillery. Using IEx doesn't raise that error. According to the stacktrace, the error seems to be coming solely from Swarm, which doesn't seem right… The Slave.AdminListener is only called with Node.self as an argument.

21:26:16.609 [info]  Application slave exited: Slave.Application.start(:normal, []) returned an error: shutdown: failed to start child: Slave.AdminListener
    ** (EXIT) an exception was raised:
        ** (ArgumentError) argument error
            (stdlib) :ets.lookup(:swarm_registry, :"example@moira.daemons")
            (swarm) lib/swarm/registry.ex:120: Swarm.Registry.get_by_name/1
            (swarm) lib/swarm/registry.ex:24: Swarm.Registry.whereis/1
            (stdlib) gen.erl:75: :gen.start/6
            (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:348: :supervisor.start_children/3
            (stdlib) supervisor.erl:314: :supervisor.init_children/2
            (stdlib) gen_server.erl:365: :gen_server.init_it/2
{"Kernel pid terminated",application_controller,"{application_start_failure,slave,{{shutdown,{failed_to_start_child,'Elixir.Slave.AdminListener',{'EXIT',{badarg,[{ets,lookup,[swarm_registry,'example@moira.daemons'],[]},{'Elixir.Swarm.Registry',get_by_name,1,[{file,\"lib/swarm/registry.ex\"},{line,120}]},{'Elixir.Swarm.Registry',whereis,1,[{file,\"lib/swarm/registry.ex\"},{line,24}]},{gen,start,6,[{file,\"gen.erl\"},{line,75}]},{supervisor,do_start_child,2,[{file,\"supervisor.erl\"},{line,365}]},{supervisor,start_children,3,[{file,\"supervisor.erl\"},{line,348}]},{supervisor,init_children,2,[{file,\"supervisor.erl\"},{line,314}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,365}]}]}}}},{'Elixir.Slave.Application',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,slave,{{shutdown,{failed_to_start_child,'Elixir.Slave.AdminListener',{'EXIT',{badarg,[{ets,lookup,[swarm_registry,'example@mo

So in the end, what caused the crash was the inclusion of a sub-application that did not have an application.ex file and that was meant to be used as a library.