nithin

nithin

Request to phoenix server times out after 60 seconds

My api endpoint process the request for more than 60 seconds. Then empty reply is being sent to the client. How would I increase the request timeout? Thanks

Most Liked

outlog

outlog

it’s a new default in Cowboy 2 - can be changed using protocol_options - idle_timeout in the endpoint config

config :hello, HelloWeb.Endpoint,
  http: [ port: 4000, 
             protocol_options: [idle_timeout: 5_000_000] 
        ],...

https://github.com/phoenixframework/phoenix/issues/3190

NobbZ

NobbZ

This worked on my local clone of the linked repository:

$ time curl -v localhost:4001/api/test
*   Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 4001 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 4001 (#0)
> GET /api/test HTTP/1.1
> Host: localhost:4001
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 200 OK
< cache-control: max-age=0, private, must-revalidate
< content-length: 17
< content-type: application/json; charset=utf-8
< date: Wed, 13 Mar 2019 11:45:38 GMT
< server: Cowboy
< x-request-id: 2m5o42cfnvn7nmsujk0000e3
<
* Connection #0 to host localhost left intact
[{"test":"test"}]

The changes I did:

diff --git a/config/dev.exs b/config/dev.exs
index 6e25348..3e4b96d 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -7,7 +7,7 @@ use Mix.Config
 # watchers to your application. For example, we use it
 # with webpack to recompile .js and .css sources.
 config :demo, DemoWeb.Endpoint,
-  http: [port: 4001],
+  http: [port: 4001, protocol_options: [idle_timeout: 70_000]],
   debug_errors: true,
   code_reloader: true,
   check_origin: false,
outlog

outlog

yep, :infinity also works..

[idle_timeout: :infinity]

this issue also popped up here Video streaming connection closed automatically - one could argue for phoenix having :infinity as a default.. on the other hand 60 secs is a “sane” default..

would say there might be a need for an explicit config showing 60_000 as the configured.. the hidden default kinda falls into the implicit category - that I’m not a fan of..

Where Next?

Popular in Questions Top

nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New

Other popular topics Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement