kazoo icon indicating copy to clipboard operation
kazoo copied to clipboard

gevent is only usable from a single thread exception while get zk node data

Open BlackRider97 opened this issue 10 years ago • 3 comments

File "/usr/local/lib/python2.7/dist-packages/kazoo/client.py", line 978, in get return self.get_async(path, watch).get() File "/usr/local/lib/python2.7/dist-packages/gevent/event.py", line 214, in get result = get_hub().switch() File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 135, in get_hub raise NotImplementedError('gevent is only usable from a single thread') NotImplementedError: gevent is only usable from a single thread

kazoo==2.0 Python 2.7.6

BlackRider97 avatar Apr 24 '15 07:04 BlackRider97

Have u monkey patched the rest of your application, mixing threads and coroutines never seems to end well (the same can be said about eventlet too, see https://review.openstack.org/#/c/154642/2/specs/eventlet-best-practices.rst for some interesting other details)....

  • http://gevent.org/intro.html#monkey-patching

harlowja avatar May 12 '15 17:05 harlowja

No. I am simply using Python multi-threading.

BlackRider97 avatar May 12 '15 17:05 BlackRider97

Ya, I think that's probably why, gevent (and eventlet to) both act like this when used in mixed-mode. So I'd personally not recommend mixing.

harlowja avatar May 12 '15 18:05 harlowja