-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for eventlet Python event loop #15923
Comments
Hi, I have a very similar setup and seeing similar errors when trying to use grpc with gevent. From quick online search it seems like it's coming from the incompatibility between grpc and greenlet (even though initial experimental support for gevent was introduced to grpcio half a year ago).
I am using: |
I see, so mine is a different issue. Ok will force the 'libev' engine and open separate issues if it doesn't work. Thanks |
is there any option for using, e.g., google-cloud-spanner in a django app running with eventlet + gunicorn? I don't really want to have to change my entire app server just to support calling an API... but setting |
This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 180 days. It will be closed automatically if no further update occurs in 1 day. Thank you for your contributions! |
Trying to use the gRPC library in a Python program that uses the Eventlet library doesn't work as expected, and we end up with deadlocks and blocked threads. This patch adds a custom eventlet IO manager to provide compatibility between the Eventlet and gRPC libraries. The code includes 2 workarounds for existing eventlet bugs, but this code is compatible with the proposed PRs to solve them, so there should be no problem if/when implements a fix for them: - eventlet/eventlet#508 - eventlet/eventlet#599 An extra import and call is necessary for applications to use gRPC with eventlets. This call must be done after eventlet has monkey patched the Python libraries. The code would look something like this: import eventlet eventlet.monkey_patch() # noqa import grpc from grpc.experimental import eventlet as grpc_eventlet if __name__ == '__main__': grpc_eventlet.init_eventlet() Resolve grpc#15923
Trying to use the gRPC library in a Python program that uses the Eventlet library doesn't work as expected, and we end up with deadlocks and blocked threads. This patch adds a custom eventlet IO manager to provide compatibility between the Eventlet and gRPC libraries. The code includes 2 workarounds for existing eventlet bugs, but this code is compatible with the proposed PRs to solve them, so there should be no problem if/when implements a fix for them: - eventlet/eventlet#508 - eventlet/eventlet#599 An extra import and call is necessary for applications to use gRPC with eventlets. This call must be done after eventlet has monkey patched the Python libraries. The code would look something like this: import eventlet eventlet.monkey_patch() # noqa import grpc from grpc.experimental import eventlet as grpc_eventlet if __name__ == '__main__': grpc_eventlet.init_eventlet() Resolve grpc#15923
Trying to use the gRPC library in a Python program that uses the Eventlet library doesn't work as expected, and we end up with deadlocks and blocked threads. This patch adds a custom eventlet IO manager to provide compatibility between the Eventlet and gRPC libraries. The code includes 2 workarounds for existing eventlet bugs, but this code is compatible with the proposed PRs to solve them, so there should be no problem if/when implements a fix for them: - eventlet/eventlet#508 - eventlet/eventlet#599 An extra import and call is necessary for applications to use gRPC with eventlets. This call must be done after eventlet has monkey patched the Python libraries. The code would look something like this: import eventlet eventlet.monkey_patch() # noqa import grpc from grpc.experimental import eventlet as grpc_eventlet if __name__ == '__main__': grpc_eventlet.init_eventlet() Resolve grpc#15923
Trying to use the gRPC library in a Python program that uses the Eventlet library doesn't work as expected, and we end up with deadlocks and blocked threads. This patch adds a custom eventlet IO manager to provide compatibility between the Eventlet and gRPC libraries. The code includes 2 workarounds for existing eventlet bugs, but this code is compatible with the proposed PRs to solve them, so there should be no problem if/when implements a fix for them: - eventlet/eventlet#508 - eventlet/eventlet#599 An extra import and call is necessary for applications to use gRPC with eventlets. This call must be done after eventlet has monkey patched the Python libraries. The code would look something like this: import eventlet eventlet.monkey_patch() # noqa import grpc from grpc.experimental import eventlet as grpc_eventlet if __name__ == '__main__': grpc_eventlet.init_eventlet() Resolve grpc#15923
grpc calls block eventlet's (0.22+) greenthreads. I think that's because libevent isn't supported by grpc.
What version of gRPC and what language are you using?
python 2.7.13+
grpc 1.12.1
What operating system (Linux, Windows, …) and version?
Linux (Ubuntu 14.04, 16.04)
What runtime / compiler are you using (e.g. python version or version of gcc)
python 2.7.13+
What did you do?
I've modified original helloworld example:
https://github.com/grpc/grpc/tree/master/examples/python/helloworld
The purpose was to run 2 greenthreads: one handling grpc call, second doing some computation
in the same time.
Simple client modification:
In server I've added some sleep to delay the response.
What did you expect to see?
I wanted to have those 2 threads running in the same time in non-blocking manner.
What did you see instead?
gRPC greenthread blocked the other thread.
Anything else we should know about your project / environment?
eventlet 0.22+
The text was updated successfully, but these errors were encountered: