elixir-plug / plug_cowboy

Plug adapter for the Cowboy web server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when `timeout` is specified

binaryseed opened this issue · comments

There was a recent change to remove the timeout config option:

If this option is still specified, it's now causing the option to get passed to the underlying transport, where it causes a badarg error when starting ranch...

I'm wondering if we should do more to protect against this... drop the option or raise an error?

@josevalim

10:20:40 18:20:40.815 [error] Child :ranch_acceptors_sup of Supervisor #PID<0.637.0> (:ranch_listener_sup) failed to start
10:20:40 ** (exit) :badarg
10:20:40 Start Call: :ranch_acceptors_sup.start_link(Main.HttpServer.HTTP, :ranch_tcp)
10:20:40 
10:20:40 18:20:40.815 [error] Process #PID<0.639.0> terminating
10:20:40 ** (exit) :badarg
10:20:40     (kernel) inet_tcp.erl:142: :inet_tcp.listen/2
10:20:40     (ranch) /work/src/source.datanerd.us/after/nerd-graph/deps/ranch/src/ranch_acceptors_sup.erl:39: :ranch_acceptors_sup.init/1
10:20:40     (stdlib) supervisor.erl:295: :supervisor.init/1
10:20:40     (stdlib) gen_server.erl:374: :gen_server.init_it/2
10:20:40     (stdlib) gen_server.erl:342: :gen_server.init_it/6
10:20:40     (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
10:20:40 Initial Call: :ranch_acceptors_sup.init/1
10:20:40 Ancestors: [#PID<0.637.0>, Main.Supervisor, #PID<0.634.0>]
10:20:40 
10:20:40 18:20:40.823 [error] Child {:ranch_listener_sup, Main.HttpServer.HTTP} of Supervisor Main.Supervisor failed to start
10:20:40 ** (exit) shutdown: failed to start child: :ranch_acceptors_sup
10:20:40     ** (EXIT) :badarg
10:20:40 Start Call: :ranch_listener_sup.start_link(Main.HttpServer.HTTP, :ranch_tcp, %{max_connections: 16384, num_acceptors: 100, socket_opts: [port: 3001, timeout: :infinity]}, :cowboy_clear, %{compress: true, env: %{dispatch: [{:_, [], [{:_, [], Plug.Cowboy.Handler, {Main.HttpServer, []}}]}]}, idle_timeout: 300000, max_header_value_length: 8192, stream_handlers: [:cowboy_compress_h, Plug.Cowboy.Stream]})
10:20:40 
10:20:40 18:20:40.823 [error] Process #PID<0.633.0> terminating
10:20:40 ** (exit) exited in: Main.Application.start(:normal, [])
10:20:40     ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, Main.HttpServer.HTTP}
10:20:40         ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup
10:20:40             ** (EXIT) :badarg
10:20:40     (kernel) application_master.erl:138: :application_master.init/4
10:20:40     (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
10:20:40 Initial Call: :application_master.init/4
10:20:40 Ancestors: [#PID<0.632.0>]
10:20:40 ** (Mix) Could not start application main: Main.Application.start(:normal, []) returned an error: shutdown: failed to start child: {:ranch_listener_sup, Main.HttpServer.HTTP}
10:20:40     ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup
10:20:40         ** (EXIT) :badarg

Fixed in master and v2.1.2 has been shipped!

Nice, thanks!