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.
@@ 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.
clrpackages added a commit to clearlinux-pkgs/eventlet that referenced this issue
Sep 25, 2020
… 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
bors bot added a commit to duckinator/parts.horse that referenced this issue
Sep 25, 2020
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 <email@example.com>
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.