-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
GET timeout after POST request #833
Comments
Can you give the handler code for the POST and/or more info about what kind of handler and what it is doing? |
Sure. It is a XHR file upload request, here is the handler: |
And here is dispatcher: dispatch_rules() -> |
Thanks, I will try in a few days, I have quite a backlog right now. :-) |
I can provide you a test server if you'd like to, with a running On Tue, Jul 14, 2015 at 9:14 AM, Loïc Hoguin notifications@github.com
With best regards, |
If I fail to reproduce the issue then perhaps, thanks. Today I can't work though so I will get back to you. |
Any luck meanwhile? :) |
Sorry, haven't had much time to work on Cowboy yet. |
Don't see the issue, but one thing though: the only place in Cowboy with 15000 is the default socket read timeout when reading the body. Since GET has no body, guessing it's POST that has issues? |
I'm facing similar issue and the stack trace shows
@essen 's last comment seems to make more sense with this stack trace and corresponding line(plug/parsers/urlencoded.ex:10) in code Also in my case this issue started after I followed the phoenixframework/phoenix#459 (comment) to read request body and added the below code in endpoint.ex defp copy_req_body(conn, _) do
{:ok, body, _} = Plug.Conn.read_body(conn, length: 1_000_000_000)
Plug.Conn.put_private(conn, :raw_request_body, body)
end
plug :copy_req_body
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison More context on the problem is posted on http://stackoverflow.com/questions/33637418/elixir-phoenix-on-heroku-timeout-error-after-15-seconds Is there a way to fix this? Would increasing socket timeout solve this issue? If so, how to increase the time out? |
Basically no idea what you just said, but to answer the question, yes, the timeout can be increased on a per call basis. See the manual for the body functions. |
The issue arises if a GET request followed by POST request. So probably this is the case: POST somehow tries to read till timeout, and therefore following GET request is not handled. |
I haven't been able to retry this, and am not sure this still applies to master (body reading has changed) so I will be closing this. Thanks! |
Cowboy version 1.0.1
GET request terminates by timeout (15 seconds) if follows POST request.
As a work-around I just manually close HTTP connection right after POST request.
Please see HTTP messages log down here:
T 127.0.0.1:46915 -> 127.0.0.1:9080 [AP]
POST /store HTTP/1.1.
Host: localhost:9080.
Connection: keep-alive.
Content-Length: 28161.
Pragma: no-cache.
Cache-Control: no-cache.
Accept: /.
Origin: http://localhost:9080.
X-Requested-With: XMLHttpRequest.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36.
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypxEP1lB353zVwsgJ.
Referer: http://localhost:9080/.
Accept-Encoding: gzip, deflate.
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4.
.
T 127.0.0.1:9080 -> 127.0.0.1:46915 [AP]
HTTP/1.1 200 OK.
connection: keep-alive.
server: Cowboy.
date: Fri, 12 Jun 2015 20:46:04 GMT.
content-length: 0.
.
T 127.0.0.1:46915 -> 127.0.0.1:9080 [AP]
GET /store/avatar/3622058535?1434141965084 HTTP/1.1.
Host: localhost:9080.
Connection: keep-alive.
Pragma: no-cache.
Cache-Control: no-cache.
Accept: image/webp,/;q=0.8.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36.
Referer: http://localhost:9080/.
Accept-Encoding: gzip, deflate, sdch.
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4.
-------------------------- 15 seconds timeout -------------------------
-------------------- Request repeated by browser -------------------
T 127.0.0.1:46917 -> 127.0.0.1:9080 [AP]
GET /store/avatar/3622058535?1434141965084 HTTP/1.1.
Host: localhost:9080.
Connection: keep-alive.
Pragma: no-cache.
Cache-Control: no-cache.
Accept: image/webp,/;q=0.8.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36.
Referer: http://localhost:9080/.
Accept-Encoding: gzip, deflate, sdch.
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4.
.
T 127.0.0.1:9080 -> 127.0.0.1:46917 [AP]
HTTP/1.1 200 OK.
transfer-encoding: identity.
server: Cowboy.
date: Fri, 12 Jun 2015 20:46:19 GMT.
connection: close.
content-type: image/jpeg.
The text was updated successfully, but these errors were encountered: