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.

Author gvanrossum
Recipients Justin Mayfield, gvanrossum, thehesiod, vstinner, yselivanov
Date 2015-11-12.16:46:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAP7+vJJ5rJ98bR4QBXx4sQu4nSvwR4O=yXvACALv=qO8VqX0jw@mail.gmail.com>
In-reply-to <1447307664.22.0.793191556512.issue25593@psf.upfronthosting.co.za>
Content
I thought some more about this. The problem is due to stopping and
restarting the loop, and that's also something that occurs in
Alexander's example code, so I retract my accusation of aiohttp (and I
don't think I need more investigation of his code).

I recall that I thought a LOT about whether to run callbacks and then
poll the selector or the other way around. The issue is that in the
"steady state" it doesn't matter because the two would alternate
either way; but in edge cases it does matter, as we've seen here.

I worry about a scenario where a callback does something like this:

def evil():
    loop.call_soon(evil)
    loop.stop()

Then the following code would never poll the selector with your fix
(let's assume there are active FDs):

evil()
while True:
    loop.run_forever()

Using the existing strategy it would still poll the selector.

Also, several tests fail with your patch -- I have to investigate those.

All in all I think replacing fut.cancelled() with fut.done() may be
the way to go.
History
Date User Action Args
2015-11-12 16:46:25gvanrossumsetrecipients: + gvanrossum, vstinner, yselivanov, thehesiod, Justin Mayfield
2015-11-12 16:46:25gvanrossumlinkissue25593 messages
2015-11-12 16:46:24gvanrossumcreate