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

gh-103417: Fix: infinite run (timefunc in scheduler example) #111497

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

mauricelambert
Copy link
Contributor

@mauricelambert mauricelambert commented Oct 30, 2023

Infinite run - sched documentation

I modify the timefunc function in the scheduler example because example was write for time.time and not for time.monotonic. This mistake cause an infinite run.


📚 Documentation preview 📚: https://cpython-previews--111497.org.readthedocs.build/

@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Oct 30, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 30, 2023
@serhiy-storchaka serhiy-storchaka changed the title Fix: infinite run (timefunc in scheduler example) gh=103417: Fix: infinite run (timefunc in scheduler example) Jan 28, 2024
@serhiy-storchaka serhiy-storchaka changed the title gh=103417: Fix: infinite run (timefunc in scheduler example) gh-103417: Fix: infinite run (timefunc in scheduler example) Jan 28, 2024
@serhiy-storchaka serhiy-storchaka added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Jan 28, 2024
@terryjreedy
Copy link
Member

@serhiy-storchaka Is the proper fix to revert the change from .time to .monotonic (and not worry about DST changes)? If so, this looks ready to commit.

Or should the example be fixed to run with time.monotonic?

@serhiy-storchaka
Copy link
Member

The example was initially written for time.time(). If we want to show the example for time.monotonic(), it should be completely rewritten.

I am not sure that changing the default timer was correct. It is a breaking change, and it was especially bad in intermediate versions, when the timer was depended on platform. But it is too later to change it back.

DST changes do not affect this. The time.time() timer can go back only if the user manually adjusts the system clock.

@serhiy-storchaka serhiy-storchaka merged commit cb287d3 into python:main Feb 25, 2024
30 checks passed
@miss-islington-app
Copy link

Thanks @mauricelambert for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 25, 2024
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
(cherry picked from commit cb287d3)

Co-authored-by: mauricelambert <50479118+mauricelambert@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Feb 25, 2024

GH-115908 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 25, 2024
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
(cherry picked from commit cb287d3)

Co-authored-by: mauricelambert <50479118+mauricelambert@users.noreply.github.com>
@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Feb 25, 2024
@bedevere-app
Copy link

bedevere-app bot commented Feb 25, 2024

GH-115909 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 25, 2024
serhiy-storchaka pushed a commit that referenced this pull request Feb 25, 2024
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
(cherry picked from commit cb287d3)

Co-authored-by: mauricelambert <50479118+mauricelambert@users.noreply.github.com>
serhiy-storchaka pushed a commit that referenced this pull request Feb 25, 2024
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
(cherry picked from commit cb287d3)

Co-authored-by: mauricelambert <50479118+mauricelambert@users.noreply.github.com>
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants