From 172a81e42bc30da1bd4027db9cd3b6172469f7fe Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 31 Jul 2018 08:29:07 -0700 Subject: [3.7] bpo-34263 Cap timeout submitted to epoll/select etc. to one day. (GH-8532) (GH-8586) --- Lib/asyncio/base_events.py | 5 ++++- Misc/NEWS.d/next/Library/2018-07-28-17-00-36.bpo-34263.zUfRsu.rst | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2018-07-28-17-00-36.bpo-34263.zUfRsu.rst diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index dc0ca3f..a79e123 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -63,6 +63,9 @@ _FATAL_ERROR_IGNORE = (BrokenPipeError, _HAS_IPv6 = hasattr(socket, 'AF_INET6') +# Maximum timeout passed to select to avoid OS limitations +MAXIMUM_SELECT_TIMEOUT = 24 * 3600 + def _format_handle(handle): cb = handle._callback @@ -1702,7 +1705,7 @@ class BaseEventLoop(events.AbstractEventLoop): elif self._scheduled: # Compute the desired timeout. when = self._scheduled[0]._when - timeout = max(0, when - self.time()) + timeout = min(max(0, when - self.time()), MAXIMUM_SELECT_TIMEOUT) if self._debug and timeout != 0: t0 = self.time() diff --git a/Misc/NEWS.d/next/Library/2018-07-28-17-00-36.bpo-34263.zUfRsu.rst b/Misc/NEWS.d/next/Library/2018-07-28-17-00-36.bpo-34263.zUfRsu.rst new file mode 100644 index 0000000..799463b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-07-28-17-00-36.bpo-34263.zUfRsu.rst @@ -0,0 +1,2 @@ +asyncio's event loop will not pass timeouts longer than one day to +epoll/select etc. -- cgit v0.12