Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-fatal exception raised during automatic code reload #5

Open
YellowApple opened this issue Feb 25, 2016 · 7 comments
Open

Non-fatal exception raised during automatic code reload #5

YellowApple opened this issue Feb 25, 2016 · 7 comments

Comments

@YellowApple
Copy link
Member

During the request immediately following a source code change:

08:21:18.469 [info]  GET /

08:21:18.470 [error] #PID<0.1025.0> running Foo.Router terminated
Server: localhost:4000 (http)
Request: GET /
** (exit) an exception was raised:
    ** (Plug.Conn.AlreadySentError) the response was already sent
        (plug) lib/plug/conn.ex:864: Plug.Conn.register_before_send/2
        (splor) lib/foo/router.ex:1: Foo.Router.do_call/2
        (splor) lib/plug/debugger.ex:93: Foo.Router.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

08:21:18.499 [info]  GET /

08:21:18.499 [info]  Sent 200 in 26µs

Router resembles the following:

defmodule Foo.Router do
  use Sugar.Router
  plug Sugar.Plugs.HotCodeReload
  plug Plug.Logger  # Not necessary to reproduce, but logs the requests

  # ...

  get "/", Foo.Controllers.Main, :index
end

Controller resembles the following:

defmodule Foo.Controllers.Main do
  use Sugar.Controller

  def index(conn, _) do
    conn |> render  # or something; this doesn't matter
  end
end

My hypothesis is that the exception is coming from a stale connection (namely, the one that initiated the code reload). Totally harmless, but would be worth checking out nonetheless if it's a sign of some optimization issue (it's possible that we might be able to shave a bit more off that rather slow 26-microsecond response time ;) ).

@CharlesOkwuagwu
Copy link

I guess its more than that. I should mention, it happens even when my source has not changed, so I don't know it is the re-load feature thats responsible

@YellowApple
Copy link
Member Author

That's interesting. In your case, does the connection still go through (i.e. the page still loads)? Does it happen on every page load? Or is it intermittent.

The issue documented here has been a rather longstanding one. Any new wrinkles might help identify the actual cause.

@CharlesOkwuagwu
Copy link

Most pages. And yes, the page still goes through

@dottorblaster
Copy link

I can confirm this. Anyone figured it out?

@YellowApple
Copy link
Member Author

@dottorblaster The error should be non-fatal and harmless (page should still load fine) per above. Is this still the case in your situation?

@dottorblaster
Copy link

Yeah absolutely harmless but it polls my log 😬

@xFluffyke420

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants