-
Notifications
You must be signed in to change notification settings - Fork 333
only trampoline when we block #314
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
Conversation
| except OSError as e: | ||
| if get_errno(e) not in SOCKET_BLOCKING: | ||
| raise IOError(*e.args) | ||
| self._trampoline(self, read=True) |
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.
this works either way, but i think having it inside the except clause is more semantically correct (and copying this is what caused the error below)
|
Thanks for patch. |
|
do you mean Tried but failed to trigger the same issue from the eventlet test suite. Not suggesting the above should be added, just included it for reference if anyone else wants to try to to reproduce it. |
|
do you need anything else here? |
|
Not with code, but field testing would be nice. |
|
is that something you are looking for from me? |
|
I think we should have a reliable unit test included in the same patch as the issue seems nontrivial. |
|
@jstasiak as i mentioned, i haven't been able to reproduce in a test scenario. i can trigger the bug using pytest and the minimal example in the description. any help writing a test would be appreciated |
|
I take test. Anybody willing to run this version on their systems - much appreciated. |
|
To add another datapoint: I had been testing this on os x, which is where pytest hangs without this patch. On linux i instead get a |
|
So if i understand correctly, this change just disturbs things enough (in my particular case) to avoid a bug elsewhere. In that case, this is a simple performance improvement (no need to trampoline until we block), and the existing test should be sufficient. |
|
ok. some more digging: the simultaneous read might be a red herring (or an effect of something). hadn't noticed there was another exception being raised earlier: looks like we are getting
do you know what causes this? |
|
ok, now that i have something better to look for, i guess i'm just hitting #256, fixed by #257 (merge conflicts are just that multiple tests were added in could still (separately) take the slight perf improvement in this pr, though that's less important |
|
Thanks for investigation. Let's put this trampoline optimisation on hold for a while and continue with #257. |
|
hi. do you need anything else from me to move this forward? |
|
It would be great to see a fix for this, or #257 |
| @@ -0,0 +1,42 @@ | |||
| import eventlet | |||
| eventlet.monkey_patch() | |||
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.
Please, follow this pattern for isolated tests:
__test__ = False
if __name__ == '__main__':
import eventlet
# and everything else
monkey_patch() at module level is a hidden bomb in a file that is potentially imported by test runner collector.
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.
thanks, hadn't noticed that the standards had moved since that test was written. updated now
|
Field testing is very welcome. Thanks, @davidszotten |
|
thanks. nameko is a decent sized open source library that makes heavy use of eventlet. there is already a travis job that runs against the latest released version of eventlet, but if it would help we could probably add one against eventlet master (with failure allowed) |
|
Yes, please! CI of different code against master would be super awesome. |
update
bugfix: only trampoline after catching a "blocking" ioerror. trampolining might otherwise fail, e.g. if using epoll and the fd happens to be a regular file (would never block)
test thanks to @Haypo from #257
original description, kept for posterity
wasn't able to figure out how to reproduce in a test, but can be trigged with a pytest test:
hangs on py3 without this patch