samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 47 forks source link

Bug: Can't start Rihanna supervisor on Elixir 1.5 #22

Closed barisbalic closed 6 years ago

barisbalic commented 6 years ago

I've been running an Elixir app on Heroku, once I introduced Rihanna it began crashing on startup. Upgrading to Elixir 1.6 remedies the problem but the docs state 1.5 should work so I'm reporting the stack traces here.

Adding the supervisor as described...

supervisor(Rihanna.Supervisor, [name: Rihanna.Supervisor, postgrex: My.Repo.config()])

Results in...

Application archie exited: Archie.Application.start(:normal, []) returned an error: shutdown: failed to start child: Rihanna.Supervisor
** (EXIT) an exception was raised:
** (FunctionClauseError) no function clause matching in Keyword.pop_first/3
(elixir) lib/keyword.ex:959: Keyword.pop_first({:name, Rihanna.Supervisor}, :postgrex, [])
(rihanna) lib/rihanna/supervisor.ex:32: Rihanna.Supervisor.start_link/2
(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:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,archie,{{shutdown,{failed_to_start_child,'Elixir.Rihanna.Supervisor',{'EXIT',{function_clause,[{'Elixir.Keyword',pop_first,[{name,'Elixir.Rihanna.Supervisor'},postgrex,[]],[{file,\"lib/keyword.ex\"},{line,959}]},{'Elixir.Rihanna.Supervisor',start_link,2,[{file,\"lib/rihanna/supervisor.ex\"},{line,32}]},{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,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}}},{'Elixir.Archie.Application',start,[normal,[]]}}}"}
samsondav commented 6 years ago

Hey Baris, thanks for opening a bug.

I have changed the README so it now has the correct way to do this - see https://github.com/samphilipd/rihanna/commit/fe1e08ec9e67755d4fcd3c5db5f2f6184c984e3c

Please let me know if this fixes your problem

barisbalic commented 6 years ago

@samphilipd good catch, it works fine now.