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

problem with select library #274

Closed
cedriclecoz opened this issue May 6, 2015 · 4 comments
Closed

problem with select library #274

cedriclecoz opened this issue May 6, 2015 · 4 comments

Comments

@cedriclecoz
Copy link

Hi all,

I'm trying to test the websocket mechanism of our server.

I have a python script, in stand alone, it establishes websockets connections, then a thread poll the websocket files descriptors to know when to receive.
when i try to integrate this script with locust, at runtime i get the following error :

phoenix/ERROR/stderr: Traceback (most recent call last):
phoenix/ERROR/stderr: File "/usr/local/bin/locust", line 9, in
phoenix/ERROR/stderr:
phoenix/ERROR/stderr: load_entry_point('locustio==0.7.2', 'console_scripts', 'locust')()
phoenix/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locustio-0.7.2-py2.7.egg/locust/main.py", line 349, in main
phoenix/ERROR/stderr:
phoenix/ERROR/stderr: docstring, locusts = load_locustfile(locustfile)
phoenix/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locustio-0.7.2-py2.7.egg/locust/main.py", line 321, in load_locustfile
phoenix/ERROR/stderr:
phoenix/ERROR/stderr: imported = import(os.path.splitext(locustfile)[0])
phoenix/ERROR/stderr: File "/home/cedricl/AVIRER/locustfile.py", line 28, in
phoenix/ERROR/stderr:
phoenix/ERROR/stderr: wsPoll = select.epoll()
phoenix/ERROR/stderr: AttributeError
phoenix/ERROR/stderr: :
phoenix/ERROR/stderr: 'module' object has no attribute 'epoll'

on a working script, if i just add a locust import, (for example: from locust import TaskSet)
it produce the trace.

on a working locust script (one of the example), adding the following 2 lines :
import select
wsPoll = select.epoll()

produce the problem.

Does anyone know how to use epoll or poll with locust ?

Thanks,
Cedric.

@cgoldberg
Copy link
Member

do you have a local file/module named "select.py" that is shadowing the "select" module from the standard library?

@cedriclecoz
Copy link
Author

Hi,

no i don't, my working script is in the same folder as the locustfile.py, and just for info, just adding a locust import (for example: from locust import TaskSet) at the top of my non-locust script make it crash.

I did go around my problem by using my script as a standalone, with a pair of sockets between it and locust to communicate.

Thanks,

@heyman
Copy link
Member

heyman commented May 7, 2015

I believe this might be due to gevent monkey patching select.

Just running the following also fails:

from gevent import monkey
monkey.patch_all()
import select
select.epoll

Locust runs gevent's monkey.patch_all() at the start.

@cedriclecoz
Copy link
Author

Ok, i will continue with my separate process then.
Thanks,

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

No branches or pull requests

4 participants