Green threads (eventlet) and debugger support

I am evaluating PyCharm and have a question about debugging and green threads. The code I'm working with uses the eventlet library. Hitting a breakpoint yields a "cannot switch to a different thread" error as the happens on a different thread. Given the popularity of green threads I suspect that this scenario must be supported, and am looking for information about how to deal with it in the debugger. Thank you,

-D

2 comments
Comment actions Permalink

I am also facing the same issue and like to know if there is any solution to this.  Not knowing much about how this works, I have tried putting the following in the $PYDEV/helpers/pydev/pydevd.py

    try:

        from gevent import monkey

        print("starting monkey patching>>>>>")

        monkey.patch_all()

        print("patched all")

    except ImportError as inst:

        print ("EXCEPTION>>>>>>>>>>>>While monkey patching pydevd")

        print(inst)

        pass

After this when I start a debug session the launch hangs with the following
/usr/bin/python2.7 /home/aswin/exes/pycharm-2.0.2/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 54781 --file /opt/stack/nova/bin/nova-api
starting monkey patching>>>>>
[('/home/aswin/exes/pycharm-2.0.2/helpers/pydev/pydevd.py', 1317, '<module>', 'print repr(traceback.extract_stack())')]
patched all
pydev debugger: process 26218 is connecting.
Any help here would be hugely appreciated.
0
Comment actions Permalink

We have investigated this issue, and unfortunately we haven't been able to make it work. It looks like the only reasonable solution for debugging gevent applications is to use Wing IDE, which has a debugger runtime written in C and not affected by gevent's monkey-patching.

0

Please sign in to leave a comment.