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

bpo-34819: Use a monotonic clock to compute timeouts in concurrent.futures #9599

Merged
merged 3 commits into from
Sep 27, 2018

Conversation

orlnub123
Copy link
Contributor

@orlnub123 orlnub123 commented Sep 27, 2018

@pitrou
Copy link
Member

pitrou commented Sep 27, 2018

Thanks for doing this! This looks good on the principle. Note however that the condition.wait in Future.get(timeout=...) will probably defer to sem_timedwait, which according to the spec should use the CLOCK_REALTIME clock (i.e. not monotonic). This means this solution is partial.

I think the NEWS message deserves improving a bit, I will edit it if you don't mind.

@pitrou
Copy link
Member

pitrou commented Sep 27, 2018

(given the above, did you check this PR solves the issue with your script, btw?)

@orlnub123
Copy link
Contributor Author

I think the NEWS message deserves improving a bit, I will edit it if you don't mind.

I'd be glad if you did, it probably does need some clarification.

(given the above, did you check this PR solves the issue with your script, btw?)

I double-checked to make sure and it indeed fixes it.

@pitrou pitrou changed the title bpo-34819: Fix Executor.map and as_completed timeouts being able to deviate bpo-34819: Use a monotonic clock to compute timeouts in concurrent.futures Sep 27, 2018
@pitrou pitrou merged commit a94ee12 into python:master Sep 27, 2018
@miss-islington
Copy link
Contributor

Thanks @orlnub123 for the PR, and @pitrou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @orlnub123 for the PR, and @pitrou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-9600 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 27, 2018
…tures (pythonGH-9599)

Use a monotonic clock to compute timeouts in :meth:`Executor.map` and :func:`as_completed`, in order to prevent timeouts from deviating when the system clock is adjusted.

This may not be sufficient on all systems. On POSIX for example, the actual waiting (e.g. in ``sem_timedwait``) is specified to rely on the CLOCK_REALTIME clock.
(cherry picked from commit a94ee12)

Co-authored-by: orlnub123 <orlnub123@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 27, 2018
…tures (pythonGH-9599)

Use a monotonic clock to compute timeouts in :meth:`Executor.map` and :func:`as_completed`, in order to prevent timeouts from deviating when the system clock is adjusted.

This may not be sufficient on all systems. On POSIX for example, the actual waiting (e.g. in ``sem_timedwait``) is specified to rely on the CLOCK_REALTIME clock.
(cherry picked from commit a94ee12)

Co-authored-by: orlnub123 <orlnub123@gmail.com>
@bedevere-bot
Copy link

GH-9601 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Sep 27, 2018
…tures (GH-9599)

Use a monotonic clock to compute timeouts in :meth:`Executor.map` and :func:`as_completed`, in order to prevent timeouts from deviating when the system clock is adjusted.

This may not be sufficient on all systems. On POSIX for example, the actual waiting (e.g. in ``sem_timedwait``) is specified to rely on the CLOCK_REALTIME clock.
(cherry picked from commit a94ee12)

Co-authored-by: orlnub123 <orlnub123@gmail.com>
miss-islington added a commit that referenced this pull request Sep 27, 2018
…tures (GH-9599)

Use a monotonic clock to compute timeouts in :meth:`Executor.map` and :func:`as_completed`, in order to prevent timeouts from deviating when the system clock is adjusted.

This may not be sufficient on all systems. On POSIX for example, the actual waiting (e.g. in ``sem_timedwait``) is specified to rely on the CLOCK_REALTIME clock.
(cherry picked from commit a94ee12)

Co-authored-by: orlnub123 <orlnub123@gmail.com>
waqasbhatti added a commit to waqasbhatti/lcc-server that referenced this pull request Sep 27, 2018
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

Successfully merging this pull request may close these issues.

5 participants