This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sched.scheduler.run() blocks scheduler
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: giampaolo.rodola, pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords: 3.3regression, needs review, patch

Created on 2012-10-08 12:05 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
schedtest.py serhiy.storchaka, 2012-10-08 12:05
sched_unblock_3.patch serhiy.storchaka, 2012-12-08 09:09 review
Messages (8)
msg172376 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-10-08 12:05
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
msg172379 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-10-08 13:08
Here is a patch that releases lock for other threads.
msg174425 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-11-01 16:09
Tests added.  Please review.
msg177146 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-08 09:09
Oh, I submitted wrong patch (it contained unrelated changes). Here is a right one.
msg178333 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-27 20:59
If no one objects I will commit this next year.
msg178359 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-12-28 04:49
Sorry for chiming in so late.
The patch looks fine to me.
msg178417 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-28 19:47
Sorry, Chris. I have opened too many browser tabs. ;)
msg178525 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-12-29 19:36
New changeset 467c46e312eb by Serhiy Storchaka in branch '3.3':
Issue #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 #16165: Fix sched.scheduler.run() method was block a scheduler for
http://hg.python.org/cpython/rev/ac919a281643
History
Date User Action Args
2022-04-11 14:57:37adminsetgithub: 60369
2021-10-21 21:59:38iritkatriellinkissue16621 superseder
2014-01-05 22:27:45r.david.murrayunlinkissue20126 superseder
2014-01-05 03:40:07r.david.murraylinkissue20126 superseder
2012-12-29 19:54:23serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2012-12-29 19:36:37python-devsetnosy: + python-dev
messages: + msg178525
2012-12-28 19:47:44serhiy.storchakasetnosy: - chris.jerdonek
messages: + msg178417
2012-12-28 19:44:33serhiy.storchakasetnosy: + chris.jerdonek
2012-12-28 04:49:04giampaolo.rodolasetmessages: + msg178359
2012-12-27 21:00:03serhiy.storchakasetassignee: serhiy.storchaka
2012-12-27 20:59:42serhiy.storchakasetmessages: + msg178333
2012-12-08 09:09:23serhiy.storchakasetfiles: + sched_unblock_3.patch

messages: + msg177146
2012-12-08 09:07:22serhiy.storchakasetfiles: - sched_unblock_2.patch
2012-11-01 16:17:18serhiy.storchakasetfiles: + sched_unblock_2.patch
2012-11-01 16:16:44serhiy.storchakasetfiles: - sched_unblock_2.patch
2012-11-01 16:09:14serhiy.storchakasetkeywords: + needs review
files: + sched_unblock_2.patch
messages: + msg174425
2012-11-01 16:07:27serhiy.storchakasetfiles: - sched_unblock.patch
2012-10-24 09:33:19serhiy.storchakasetstage: patch review
2012-10-08 13:08:20serhiy.storchakasetfiles: + sched_unblock.patch
keywords: + patch
messages: + msg172379
2012-10-08 12:05:24serhiy.storchakacreate