classification
Title: multiprocessing should use time.monotonic() for timeout
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2018-07-05 16:33 by vstinner, last changed 2018-07-06 15:45 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8118 merged vstinner, 2018-07-05 16:35
PR 8139 merged miss-islington, 2018-07-06 11:53
PR 8140 merged miss-islington, 2018-07-06 11:54
Messages (5)
msg321115 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-05 16:33
In different functions, the multiprocessing module uses the system clock: time.time(). The system clock can be updated manually by the system administrator or automatically by NTP (for example).

Attached PR modifies multiprocessing to use time.monotonic() instead to not be affected by system clock changes.

time.monotonic() is always available since Python 3.5. See also the PEP 418.
msg321116 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-05 16:37
Monotonic clock: https://docs.python.org/dev/library/time.html#time.monotonic
msg321168 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-06 11:51
New changeset c2368cbc83ca2bafeaea0e4760be4996046d0444 by Victor Stinner in branch 'master':
bpo-34054: multiprocessing uses time.monotonic() (GH-8118)
https://github.com/python/cpython/commit/c2368cbc83ca2bafeaea0e4760be4996046d0444
msg321169 - (view) Author: miss-islington (miss-islington) Date: 2018-07-06 12:11
New changeset 4bd5fce27d5c03a013e5ebb008670ca0d89e3298 by Miss Islington (bot) in branch '3.7':
bpo-34054: multiprocessing uses time.monotonic() (GH-8118)
https://github.com/python/cpython/commit/4bd5fce27d5c03a013e5ebb008670ca0d89e3298
msg321170 - (view) Author: miss-islington (miss-islington) Date: 2018-07-06 12:14
New changeset 972458a4245afb4e934fbcb9c0224b105fb5d7ba by Miss Islington (bot) in branch '3.6':
bpo-34054: multiprocessing uses time.monotonic() (GH-8118)
https://github.com/python/cpython/commit/972458a4245afb4e934fbcb9c0224b105fb5d7ba
History
Date User Action Args
2018-07-06 15:45:51vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-07-06 12:14:36miss-islingtonsetmessages: + msg321170
2018-07-06 12:11:23miss-islingtonsetnosy: + miss-islington
messages: + msg321169
2018-07-06 11:54:01miss-islingtonsetpull_requests: + pull_request7714
2018-07-06 11:53:03miss-islingtonsetpull_requests: + pull_request7713
2018-07-06 11:51:57vstinnersetmessages: + msg321168
2018-07-05 16:37:55vstinnersetmessages: + msg321116
2018-07-05 16:35:23vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request7703
2018-07-05 16:33:47vstinnercreate