Skip to content

Support for eventlet #39

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

Open
mnaser opened this issue Apr 15, 2025 · 1 comment
Open

Support for eventlet #39

mnaser opened this issue Apr 15, 2025 · 1 comment

Comments

@mnaser
Copy link

mnaser commented Apr 15, 2025

I've been struggling with a library which I'm writing using pyo3, where it's consumed by a Python project that uses eventlet. The issue with this model is that eventlet at it's core uses greenthreads, not threads. This means that when I added this project and used get_runtime() to call into it, I'll end up with something like this:

pyo3_runtime.PanicException: Cannot start a runtime from within a runtime. This happens because a function (like block_on) attempted to block the current thread while the thread is being used to drive asynchronous tasks.

Now, I believe that mainly the reason for this is that different greenthreads (under the same OS thread) are trying to call block_on() using the same runtime, and Tokio doesn't like that.

Spinning up a thread seems to be very much the "big bang" button, but I'm wondering if there's any plans or thoughts on how support for eventlet can be added.

@mnaser
Copy link
Author

mnaser commented Apr 15, 2025

For future readers:

https://eventlet.readthedocs.io/en/latest/threading.html#module-eventlet.tpool

In my case, I'm able to actually have a small Python shim and I wrapped it with that and I'm trying that out now, that may be my only way out for now without making my Rust code way too complicated until this code base gets out of eventlet.

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

No branches or pull requests

1 participant