So I set out to create some test case, quickstarted example project in new virtualenv, set it to use gevent(no other modification at all), and got this. Still, it loads fine in the browser.
% gearbox serve --reload -c development.ini 00:06:25,561 INFO [gearbox] Starting subprocess with file monitor 00:06:26,260 INFO [gearbox] Starting server in PID 32706. Starting Gevent HTTP server on http://127.0.0.1:2088 Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 808, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 761, in run self.__target(*self.__args, **self.__kwargs) File "/home/juro/work/testenv/lib/python2.7/site-packages/gearbox/commands/serve.py", line 762, in periodic_reload time.sleep(self.poll_interval) File "/home/juro/work/testenv/lib/python2.7/site-packages/gevent/hub.py", line 79, in sleep switch_result = get_hub().switch() File "/home/juro/work/testenv/lib/python2.7/site-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 On Friday, October 18, 2013 11:25:53 AM UTC+2, Alessandro Molina wrote: > > gearbox gevent calls patch_all when the server is started, so it might be > that it fails if somehow modules are imported before starting the server. > I'll double check this, in case it's confirmed it might be possible to > solve it with just a new gearbox release. > > What I can suggest is checking that you are not importing urllib or thread > anywhere in the "config" package of your application, it's the first thing > that gets loaded. > > > On Thu, Oct 17, 2013 at 12:00 AM, Juraj Variny <[email protected]<javascript:> > > wrote: > >> When added monkey.patch_all() directly on the top of gearbox, the problem >> vanished. So it seems gearbox is monkey patching too late - urllib2 is >> already imported somewhere and gevent then fails to patch it, as hinted by >> this: https://groups.google.com/forum/#!topic/gevent/JUWbFMcNYEM >> >> Should I create an issue for this? >> >> Juraj >> >> >> On Wednesday, October 16, 2013 11:37:18 PM UTC+2, Juraj Variny wrote: >>> >>> Hello, after upgrade to tg 2.3 and set up to use gevent, I am getting >>> exceptions like: >>> >>> AssertionError: The object popped (<tg.wsgiapp.RequestLocals object at >>> 0x4f12aa0>) is not the same as the object expected >>> (<tg.wsgiapp.RequestLocals object at 0x4cbc398>) >>> >>> It happens in controller methods that make inline remote JSONRPC calls >>> using jsonrpc-1.2 (which is based on standard urllib2) so I suspect it >>> isn't monkey patched properly . Trying gevent 1.0rc3 did not help. I don't >>> know how to tackle the problem, do you have any ideas please? >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "TurboGears" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/turbogears. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears. For more options, visit https://groups.google.com/groups/opt_out.

