Skip to content
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

Call gevent.monkey.patch_all immediately on import #703

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

bilbof
Copy link
Contributor

@bilbof bilbof commented Apr 11, 2022

The api makes use of gevent, a coroutine based networking library which relies heavily on monkey patching the stdlib.

From the gevent.monkey docs:

Warning Patching too late can lead to unreliable behaviour
(for example, some modules may still use blocking sockets) or even errors.

This appears to have happened here. Thanks to @allwyn-pradip for pointing me at the right file in PR #690!

Monkey-patching immediately resolves #686, #699, #644.

Blog on gevent: https://eng.lyft.com/what-the-heck-is-gevent-4e87db98a8

In the case of gevent — monkey patching has to be the absolute first thing a process does

The api makes use of [gevent], a coroutine based networking
library which relies heavily on monkey patching the stdlib.

From the [gevent.monkey] docs:
> Warning Patching too late can lead to unreliable behaviour
> (for example, some modules may still use blocking sockets) or even errors.

This appears to have happened here. Thanks to @allwyn-pradip for
pointing me at the right file in PR
linkedin#690.

Resolves linkedin#686, linkedin#699, linkedin#644.

Blog on gevent: https://eng.lyft.com/what-the-heck-is-gevent-4e87db98a8
> In the case of gevent — monkey patching has to be the absolute first thing a process does

[gevent]: https://www.gevent.org/index.html
[gevent.monkey]: https://www.gevent.org/api/gevent.monkey.html
@diegocepedaw diegocepedaw merged commit 6a8a70b into linkedin:master Apr 11, 2022
@bilbof bilbof deleted the bf/gvent-monkey-patch-api branch April 11, 2022 13:59
@bilbof bilbof mentioned this pull request Apr 11, 2022
@diegocepedaw
Copy link
Collaborator

@allwyn-pradip can you confirm if this fixes the issue for you?

allwyn-pradip added a commit to allwyn-pradip/iris that referenced this pull request Apr 12, 2022
Call gevent.monkey.patch_all immediately on import (linkedin#703)
@allwyn-pradip
Copy link
Contributor

@diegocepedaw -- yes it is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to publish new (or existing) Plan
3 participants