phoenixframework / phoenix_live_reload

Provides live-reload functionality for Phoenix
MIT License
315 stars 90 forks source link

Phoenix close the connection if the request need more time than normal #89

Closed bingoabs closed 5 years ago

bingoabs commented 5 years ago

Hi, I came cross a issue that the Phoenix Application will close the connection after about 60s.

I have a nginx server before the Application, I found the nginx error log show upstream prematurely closed connection while reading response header from upstream.

Check the Application log, I found the Application just close the request without any log! I think someone can find the behavior just use :timer.sleep(70_000) in any handler.

I think the endpoint is responsible for this. So I check the endpoint and find the :http - the configuration for the HTTP server. Currently uses Cowboy and accepts all options as defined by Plug.Cowboy. Defaults to false. I found I should config the cowboy, the cowboy server has some params, I think the idle_timeout or 'inactivity_timeout` is more important for this issue.

So I config the http: [protocol_options: [idle_timeout: 300_000, inactivity_timeout: 300_000]], and solve this problem.

My question is why the server not emit the error message ? I think it is hard to add the missing config if we do not have any obviously information.

josevalim commented 5 years ago

It is cowboy the one likely closing it, so the error report should happen there. Although it is worth noting that browsers and http clients will likely close connections much earlier than that if nothing is sent. --

José Valim www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D

josevalim commented 5 years ago

Closing this as mentioned, thanks for the report!

bingoabs commented 5 years ago

@josevalim I am sorry. And thanks a lot for your reply

josevalim commented 5 years ago

No worries, it was no problem at all!