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

Time out when using HTTP.request #416

Closed
remedisbetty opened this issue May 16, 2019 · 5 comments
Closed

Time out when using HTTP.request #416

remedisbetty opened this issue May 16, 2019 · 5 comments

Comments

@remedisbetty
Copy link

When I used the HTTP.request to send job to client servers, I get a response of timeout and connection closed after 60s. While, it seems that the option readtimeout doesn't work.

timeout_error.txt

Julia 1.0.3
HTTP.jl 0.8#master
WIN10

@anj00
Copy link

anj00 commented May 16, 2019

I experience the same

using HTTP, Dates, Printf

server_s = "http://127.0.0.1:8081/"
conf = (readtimeout = 10,
         retry = false,
         verbose=100)
t = time()
r = HTTP.request("GET", server_s * "health?sleep=120"; conf... )
println(@sprintf("timed out in %.1f sec", time()-t))

I have an endpoint which can sleep for what I asked it to before returning. so above code gives
timed out in 64.8 sec
and the actual error message

DEBUG: 2019-05-16T19:59:04.667 ee2c ➡️  "GET /health?sleep=120 HTTP/1.1\r\n" (write)
DEBUG: 2019-05-16T19:59:04.672 ee2c ➡️  "Host: 127.0.0.1\r\n" (write)
DEBUG: 2019-05-16T19:59:04.673 ee2c ➡️  "Content-Length: 0\r\n" (write)
DEBUG: 2019-05-16T19:59:04.673 ee2c ➡️  "\r\n" (write)
DEBUG: 2019-05-16T20:00:06.724 ee2c ⬅️  "HTTP/1.1 408 Request Time-out\r\n" (readuntil)
DEBUG:                                 "Connection: close\r\n"
DEBUG:                                 "\r\n"
ERROR: HTTP.ExceptionRequest.StatusError(408, HTTP.Messages.Response:
"""
HTTP/1.1 408 Request Time-out
Connection: close

""")

at the same time if I create a server in python (aiohttp). I see that it http.get will happily wait 120sec

DEBUG: 2019-05-16T19:45:44.26  2a27 ➡️  "GET /health?sleep=120 HTTP/1.1\r\n" (write)
DEBUG: 2019-05-16T19:45:44.261 2a27 ➡️  "Host: 127.0.0.1\r\n" (write)
DEBUG: 2019-05-16T19:45:44.262 2a27 ➡️  "Content-Length: 0\r\n" (write)
DEBUG: 2019-05-16T19:45:44.262 2a27 ➡️  "\r\n" (write)
DEBUG: 2019-05-16T19:47:44.266 2a27 ⬅️  "HTTP/1.1 200 OK\r\n" (readuntil)
DEBUG:                                 "Content-Type: application/json; charset=utf-8\r\n"
DEBUG:                                 "Content-Length: 16\r\n"
DEBUG:                                 "Date: Thu, 16 May 2019 17:47:44 GMT\r\n"
DEBUG:                                 "Server: Python/3.7 aiohttp/3.5.4\r\n"
DEBUG:                                 "\r\n"
DEBUG: 2019-05-16T19:47:44.269 2a27 ⬅️  "{\"status\": \"OK\"}" (unsafe_read)
120.007995 seconds (9.01 k allocations: 494.953 KiB)

So looks like there are 2 problems

  1. readtimeout is not respected on request side
  2. server side is doing something different compared to say aihttp in python, triggering the timeout.

I use
HTTP v0.8.0
server runs on
Bukdu v0.4.3
Julia 1.1.0
Windows 10

@anj00
Copy link

anj00 commented May 17, 2019

#2 from my list is solved. apparently there is readtimeout on the server side. so if I start server like this
Bukdu.start(port, readtimeout = 120) my http request will not get me 408 for 120 sec.

So the question remains. is readtimeout only a server side setting or it meant to work in the client side as well? if it meant to work on the HTTP.request, it doesn't look it works.

@remedisbetty
Copy link
Author

If the readtimeout works on the server side, why does it close the connection within 60s, while my time restriction is 900s?

@HBaghdadi1995
Copy link
Contributor

This was solved in #393, either ensure you have the dev version or wait until the next tag.

@quinnj
Copy link
Member

quinnj commented May 31, 2019

A new release has been tagged w/ the fix in #393; please report back here if you're still seeing issues: client or server side.

@quinnj quinnj closed this as completed May 31, 2019
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