Guido van Rossum added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com