getsentry / sentry-elixir

The official Elixir SDK for Sentry (sentry.io)
https://sentry.io
MIT License
626 stars 185 forks source link

Error and Crash on 404 Elixir.Phoenix.Router.NoRouteError #328

Closed tpitale closed 5 years ago

tpitale commented 5 years ago

Environment

Description

After upgrading to Phoenix 1.4.x and plug_cowboy 2.0, We've seen some vague errors in our logs that appear to happen on 404:

[info] time=21:32:15.579 request_id=2m0e7it2clh3g54eq40001eh method=GET path=/ time_elapsed=21ms status=404  Sent
21:32:15.580 [error] CRASH REPORT Process <0.713.0> with 0 neighbours exited with reason: {{#{'__exception__' => true,'__struct__' => 'Elixir.Phoenix.Router.NoRouteError',conn => #{'__struct__' => 'Elixir.Plug.Conn',adapter => {'Elixir.Plug.Cowboy.Conn',#{bindings => #{},body_length => 0,cert => undefined,has_body => false,headers => #{<<"accept">> => <<"*/*">>,<<"host">> => <<"">>,<<"x-amzn-trace-id">> => <<"">>,<<"x-forwarded-for">> => <<"178.73.215.171">>,<<"x-forwarde...">> => ...,...},...}},...},...},...},...} in 'Elixir.Phoenix.Endpoint.Cowboy2Handler':init/2 line 43 in 'Elixir.Phoenix.Endpoint.Cowboy2Handler':init/2 line 43
21:32:15.591 [error] Cowboy stream 1 with ranch listener 'Elixir.MyApp.Endpoint.HTTP' and connection process <0.712.0> had its request process exit with reason: {{#{'__exception__' => true,'__struct__' => 'Elixir.Phoenix.Router.NoRouteError',conn => #{'__struct__' => 'Elixir.Plug.Conn',adapter => {'Elixir.Plug.Cowboy.Conn',#{bindings => #{},body_length => 0,cert => undefined,has_body => false,headers => #{<<"accept">> => <<"*/*">>,<<"host">> => <<"">>,<<"x-amzn-trace-id">> => <<"">>,<<"x-forwarded-for">> => <<"178.73.215.171">>,<<"x-forwarde...">> => ...,...},...}},...},...},...},...} in 'Elixir.Phoenix.Endpoint.Cowboy2Handler':init/2 line 43

When searching out these errors we've found that other products similar to sentry (appsignal, honeybadger) have experienced similar issues. I'm wondering if you've seen this before and if maybe a similar change needs to happen in Sentry.

Related:

Expected Behavior

404 should not error and crash

Actual Behavior

404 appears to crash

mitchellhenke commented 5 years ago

Thanks for opening this issue!

I will take a look to see what I can do about this.

mitchellhenke commented 5 years ago

I am unfortunately unable to reproduce this. I've pushed a repository to show how I'm attempting to reproduce, and if anything in your setup looks different, let me know:

Repository: https://github.com/mitchellhenke/no_route_testing Sentry installation commit: https://github.com/mitchellhenke/no_route_testing/commit/53a2b1db3d06e50f1bec47bc9efd9ab4667e6d30

hitting any route other than / generates a 404, but I don't receive any events in Sentry, or logs like you are seeing.

Do you have any different Logger configuration or :error_logger things going on?

tpitale commented 5 years ago

We don't have this line use Sentry.Phoenix.Endpoint adding and deploying. Might have missed that when upgrading at some point in the past.

This could also all be a red herring. We have no real confirmation that sentry is the issue. Closing until I can reproduce reliably.

mitchellhenke commented 5 years ago

@tpitale My hunch is that Sentry.Phoenix.Endpoint wouldn't affect this issue, but rather that something different is going on with :logger config. Something Phoenix related is also possible, but I'm less sure.

If you'd like to discuss while you're working through it, I'm in IRC and Elixir Slack (same username) 🙂

apxcarter commented 2 weeks ago

Sorry to resurrect this, but did you ever find a solution to this? I'm seeing this with v10.4:

Process #PID<0.11925.0> terminating
** (exit) {{{%Phoenix.Router.NoRouteError{plug_status: 404, message: "no route found for GET [just the request data that 404d]