Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gevent.hub.LoopExit exeption, python threading and twisted reactor #397

Closed
NPeganov opened this issue Mar 19, 2016 · 2 comments
Closed

gevent.hub.LoopExit exeption, python threading and twisted reactor #397

NPeganov opened this issue Mar 19, 2016 · 2 comments
Labels

Comments

@NPeganov
Copy link

Hi,

The short code snippet in the file attached
test1.txt

is hitting gevent.hub.LoopExit exeption immediately after running locust (even not spawn is started). Commenting out the line
Thread(target=reactor.run, args=(False,)).start()
resolves the issue. But I do need to use twisted and reactor.run must not block the code execution.

OS: ubuntu
The output is flooded with the following messages:
[2016-03-19 10:17:04,003] ip-172-20-38-27/INFO/locust.main: Starting web monitor at _:8089
[2016-03-19 10:17:04,003] ip-172-20-38-27/INFO/locust.main: Starting Locust 0.7.3
[2016-03-19 10:17:04,012] ip-172-20-38-27/ERROR/stderr: Unhandled Error
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 784, in __bootstrap
self.__bootstrap_inner()
File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.7/threading.py", line 764, in run
self.__target(_self.__args, **self.__kwargs)
File "/usr/lib64/python2.7/site-packages/twisted/internet/base.py", line 1194, in run
self.mainLoop()
--- ---
File "/usr/lib64/python2.7/site-packages/twisted/internet/base.py", line 1206, in mainLoop
self.doIteration(t)
File "/usr/lib64/python2.7/site-packages/twisted/internet/pollreactor.py", line 155, in doPoll
l = self._poller.poll(timeout)
File "/usr/lib64/python2.7/site-packages/gevent/select.py", line 127, in poll
result.event.wait(timeout=timeout)
File "/usr/lib64/python2.7/site-packages/gevent/event.py", line 213, in wait
return self._wait(timeout)
File "/usr/lib64/python2.7/site-packages/gevent/event.py", line 123, in _wait
gotit = self._wait_core(timeout)
File "/usr/lib64/python2.7/site-packages/gevent/event.py", line 101, in _wait_core
result = self.hub.switch()
File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 606, in switch
return greenlet.switch(self)
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x277ed70 epoll pending=0 ref=0 fileno=5>)

@justiniso justiniso added the bug label Apr 2, 2016
@JunyongYao
Copy link

JunyongYao commented Nov 30, 2016

I met similar issue before and it was solved after monkey patching.

from gevent import monkey
monkey.patch_all()

And please place this code at the very beginning of your test code as gevent suggested.
Hope it is helpful for you.

@justiniso
Copy link
Member

This should be resolved, but please reopen if you see this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants