-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Create a AsyncHTTPClient request with infinite timeout #2742
Comments
There's not currently a supported way to set an infinite timeout. If there were, it would be some special value (maybe None) instead of zero. If the Future doesn't resolve with a timeout of zero, that's a bug - you should get an immediate timeout error. I'm kind of surprised that |
Is there an interest to add this kind of infinite timeout? I assume changing the meaning of While setting the timeout to a large value would be a workaround, I am afraid of limitations of the underlying operating system in that regard. After all, testing a year-long timeout is not practically possible, so having a way to disable the timeout completely seems like the cleanest solution to me. |
The relevant code in master (and the 6.0 branch) for timeout = min(self.request.connect_timeout, self.request.request_timeout)
if timeout:
self._timeout = self.io_loop.add_timeout(
self.start_time + timeout,
functools.partial(self._on_timeout, "while connecting"),
)
stream = await self.tcp_client.connect( There is no Currently you can't set There's also another place in the code where it is clear that if not len(self.active) < self.max_clients:
assert request.connect_timeout is not None
assert request.request_timeout is not None
timeout_handle = self.io_loop.add_timeout(
self.io_loop.time()
+ min(request.connect_timeout, request.request_timeout),
functools.partial(self._on_timeout, key, "in request queue"),
) |
We could create a special singleton object that would mean "no timeout", but I'm not sure it's worth it. Just setting a large but finite timeout seems like a better approach to me. |
Is there a defined way to create a request using
AsyncHTTPClient
with an infinite timeout? I am currently using the simple httpclient implementation (should also not change) and I am requesting a page that streams an infinite amount of data. I am usingstreaming_callback
to process the chunks of data.With Python 3.6.4 and Tornado 5.0.2 I set
request_timeout=0
on the fetch method call which worked. However, I recently upgraded to Python 3.7.4 and newest Tornado 6. When I setrequest_timeout=0
here, the future also never completes. However, the client will not even send a HTTP request to the destination. An example of this is the following:The program will not complete, but on the local server, there will not be a request, either. And, subsequently,
chunker
will also never be called. I can work around this by settingrequest_timeout=float('inf')
but this feels really hacky and I fear that there may be a timeout at some point in the future anyways.So question is if there is a way to never timeout the fetch request.
The text was updated successfully, but these errors were encountered: