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

sched.scheduler.run() blocks scheduler #60369

Closed
serhiy-storchaka opened this issue Oct 8, 2012 · 8 comments
Closed

sched.scheduler.run() blocks scheduler #60369

serhiy-storchaka opened this issue Oct 8, 2012 · 8 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 16165
Nosy @pitrou, @giampaolo, @serhiy-storchaka
Files
  • schedtest.py
  • sched_unblock_3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2012-12-29.19:54:23.792>
    created_at = <Date 2012-10-08.12:05:24.096>
    labels = ['type-bug', 'library']
    title = 'sched.scheduler.run() blocks scheduler'
    updated_at = <Date 2012-12-29.19:54:23.791>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2012-12-29.19:54:23.791>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2012-12-29.19:54:23.792>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2012-10-08.12:05:24.096>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['27488', '28254']
    hgrepos = []
    issue_num = 16165
    keywords = ['patch', 'needs review', '3.3regression']
    message_count = 8.0
    messages = ['172376', '172379', '174425', '177146', '178333', '178359', '178417', '178525']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'giampaolo.rodola', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue16165'
    versions = ['Python 3.3', 'Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    sched.scheduler.run() blocks scheduler and prevents the addition of new events until all events added before start will not be processed. Canceling does not work too.

    Here is test script which reproduces the behavior differences.

    Output in Python 3.2:

    Adding
    adding 0
    added 0
    adding 1
    added 1
    adding 2
    added 2
    event 0
    event 1
    start event
    event 2
    Canceling

    Output in Python 3.3:

    Adding
    adding 0
    start event
    added 0
    adding 1
    added 1
    adding 2
    added 2
    Canceling
    event 0
    event 1
    event 2
    Traceback (most recent call last):
      File "schedtest.py", line 20, in <module>
        s.cancel(e)
      File "/home/serhiy/py/cpython/Lib/sched.py", line 93, in cancel
        self._queue.remove(event)
    ValueError: list.remove(x): x not in list

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 8, 2012
    @serhiy-storchaka
    Copy link
    Member Author

    Here is a patch that releases lock for other threads.

    @serhiy-storchaka
    Copy link
    Member Author

    Tests added. Please review.

    @serhiy-storchaka
    Copy link
    Member Author

    Oh, I submitted wrong patch (it contained unrelated changes). Here is a right one.

    @serhiy-storchaka
    Copy link
    Member Author

    If no one objects I will commit this next year.

    @serhiy-storchaka serhiy-storchaka self-assigned this Dec 27, 2012
    @giampaolo
    Copy link
    Contributor

    Sorry for chiming in so late.
    The patch looks fine to me.

    @serhiy-storchaka
    Copy link
    Member Author

    Sorry, Chris. I have opened too many browser tabs. ;)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 29, 2012

    New changeset 467c46e312eb by Serhiy Storchaka in branch '3.3':
    Issue bpo-16165: Fix sched.scheduler.run() method was block a scheduler for
    http://hg.python.org/cpython/rev/467c46e312eb

    New changeset ac919a281643 by Serhiy Storchaka in branch 'default':
    Issue bpo-16165: Fix sched.scheduler.run() method was block a scheduler for
    http://hg.python.org/cpython/rev/ac919a281643

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants