mtrudel/bandit

Phoenix Adapter errors on 404

lucacorti opened this issue · 2 comments

Hi,

I'm testing out bandit with phoenix. Seems to be working fine, but process crashes are being generated when visiting non existent URLs:

** (Phoenix.Router.NoRouteError) no route found for GET / (TestWeb.Router)
    (test 0.1.0) deps/phoenix/lib/phoenix/router.ex:487: TestWeb.Router.call/2
    (test 0.1.0) lib/test_web/endpoint.ex:1: TestWeb.Endpoint.plug_builder_call/2
    (test 0.1.0) deps/plug/lib/plug/debugger.ex:136: TestlWeb.Endpoint."call (overridable 3)"/2
    (test 0.1.0) lib/test_web/endpoint.ex:1: TestWeb.Endpoint.call/2
    (phoenix 1.7.2) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
    (bandit 1.0.0-pre.3) lib/bandit/pipeline.ex:89: Bandit.Pipeline.call_plug/2
    (bandit 1.0.0-pre.3) lib/bandit/pipeline.ex:27: Bandit.Pipeline.run/6
    (bandit 1.0.0-pre.3) lib/bandit/http1/handler.ex:29: Bandit.HTTP1.Handler.handle_data/3
    (bandit 1.0.0-pre.3) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
    (bandit 1.0.0-pre.3) deps/thousand_island/lib/thousand_island/handler.ex:355: Bandit.DelegatingHandler.handle_continue/2
    (stdlib 4.3.1) gen_server.erl:1123: :gen_server.try_dispatch/4
    (stdlib 4.3.1) gen_server.erl:865: :gen_server.loop/7
    (stdlib 4.3.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:continue, :handle_connection}
State: {%ThousandIsland.Socket{socket: #Port<0.29>, transport_module: ThousandIsland.Transports.TCP, read_timeout: 60000, span: %ThousandIsland.Telemetry{span_name: :connection, telemetry_span_context: #Reference<0.3563652222.4115136514.236912>, start_time: -576460735174123005, start_metadata: %{parent_telemetry_span_context: #Reference<0.3563652222.4115136516.239539>, remote_address: {127, 0, 0, 1}, remote_port: 60722, telemetry_span_context: #Reference<0.3563652222.4115136514.236912>}}}, %{handler_module: Bandit.InitialHandler, http_1_enabled: true, http_2_enabled: true, opts: %{http_1: [], http_2: [], websocket: []}, plug: {Phoenix.Endpoint.SyncCodeReloadPlug, {TestWeb.Endpoint, []}}, websocket_enabled: true}}

These tend to generate noise in logs and monitoring. The cowboy adapter does not emit errors on 404s.

This is on bandit 1.0.0-pre3.

Thanks!

This is an upstream issue in Phoenix, being tracked as phoenixframework/phoenix#5445

Thanks for the issue!

Note that the upstream issue has been merged - this should be fixed in the next Phoenix release.