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
Listener removes wrong guy #645
Conversation
When in hubs.trampoline(fd, ...), a greenthread registers itself as a listener for fd, switches to the hub, and then calls hub.remove(listener) to deregister itself. hub.remove(listener) removes the primary listener. If the greenthread awoke because its fd became ready, then it is the primary listener, and everything is fine. However, if the greenthread was a secondary listener and awoke because a Timeout fired then it would remove the primary and promote a random secondary to primary. This commit makes hub.remove(listener) check to make sure listener is the primary, and if it's not, remove the listener from the secondaries.
There was some concern in fixing hub.remove for secondary listeners because tests seemed to rely on the implicit robustness of hub.remove when a listener wasn't being tracked. It was discovered that socket errors can bubble up in poll and select hubs which result in all listeners being removed for that fileno before the listener was alerted (which would then *also* triggered a remove). Rather than having remove be robust to being called twice this change makes it be called only once.
Codecov Report
@@ Coverage Diff @@
## master #645 +/- ##
======================================
Coverage 44% 44%
======================================
Files 87 87
Lines 11831 11839 +8
Branches 1774 1776 +2
======================================
+ Hits 5254 5277 +23
+ Misses 6180 6167 -13
+ Partials 397 395 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks a lot
… 0.28.0 Clay Gerrard (1): Make remove more explicit Samuel Merritt (1): Always remove the right listener from the hub Sergey Shepelev (1): v0.28.0 release 0.28.0 ====== * Always remove the right listener from the hub eventlet/eventlet#645
64: Update eventlet to 0.28.0 r=duckinator a=pyup-bot This PR updates [eventlet](https://pypi.org/project/eventlet) from **0.27.0** to **0.28.0**. <details> <summary>Changelog</summary> ### 0.28.0 ``` ====== * Always remove the right listener from the hub eventlet/eventlet#645 ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/eventlet - Changelog: https://pyup.io/changelogs/eventlet/ - Homepage: http://eventlet.net </details> Co-authored-by: pyup-bot <github-bot@pyup.io>
I really only intended this to be a followup to @charmster 's comment on #498
I'm not actually sure if this is better, but I do think it would also work