Error while killing gevent.greenlet

21 views
Skip to first unread message

Ayush Pratap Singh

unread,
May 30, 2023, 8:15:33 AM5/30/23
to gevent: coroutine-based Python network library
My application uses gevent 22.10.2 tand greenlet 2.0.2

It is a TCP server which spawns 3 gevent.greenlets.
During disconnection flow when the code tries to kill the greenlets it throws an exception "Cannot convert greenlet.greenlet to gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop" 

It occurs occassionally, say 1 out of 10 times.

This is how I'm creating and killing greenlets.

//Create
routine = gevent.spawn(Routine)

//kill
if routine:
    if not routine.dead:
        routine.kill() // exception thrown from here
    routine = None

These routines are also not blocked anywhere when kill is called.
 
Perhaps I'm doing something wrong? 
Reply all
Reply to author
Forward
0 new messages