You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm chasing down a 100% CPU consumption problem that is somewhere in gevent's hub run while running greenlets from future_to_greenlet.
While investigating, I wanted to make sure that greenlets were killed after being joined. (For context, I'm creating and running these futures in parallel using locust so it's a bit tricky to make sure everything is getting cleaned up.)
Thanks for raising this issue. I think the problem is that I expected the object in the file you link ed to be a future, not a coroutine object. asyncio.Future objects have a cancel() method.
To fix your code right now, I would suggest using asyncio.wrap_future to wrap your coroutine object inside a future.
And separately, I'll update the library to also support coroutine objects, because I can see why this would be unexpected/confusing.
I'm chasing down a 100% CPU consumption problem that is somewhere in gevent's hub run while running greenlets from future_to_greenlet.
While investigating, I wanted to make sure that greenlets were killed after being joined. (For context, I'm creating and running these futures in parallel using locust so it's a bit tricky to make sure everything is getting cleaned up.)
My code looked something like this:
But I was receiving an
AttributeError: 'coroutine' object has no attribute 'cancel'
duringgreenlet.kill()
, thrown from https://github.com/gfmio/asyncio-gevent/blob/main/asyncio_gevent/future_to_greenlet.py#L61Should this instead be
future.close()
? Coroutine documentation is here. This seems to work for me. My example now looks like:The text was updated successfully, but these errors were encountered: