Locust had been running fine a few months ago. Went to start it the other day and started getting errors in gevent/_tblib.py, line 202 - TypeError: an integer is required (got type bytes). Then the process exits.
I don't know what could have changed in the meantime. I had been using 0.13.02 tried 0.14.4 and got the same error. I'm on Mac OS X 10.15.3 with libev: stable 4.31.
It should have run as normal
Throws exception and quits.
Not sure. Don't think it is a code error.
Hi! Could this be related? (maybe you are running against a dns name that doesnt exist?)
Although the claim that is fixed in 1.5a2 though...
Maybe it would be worth to check with 1.5a3...
Maybe it would be worth to check with
1.5a3...
Yes! That is in locust master branch but not yet a release.
;)

I thought it was always the load balancer? :) At least it was at a company I worked at a long long time ago.
Actually, this was a big hint. It wasn't DNS in the sense of trying to find the server under test. It is/was an issue trying to bind to the web host and port for the UI. If I specify them specifically it works ie.
locust --web-host 0.0.0.0 --port 8889
I don't know if something has gone wacky with my machine or its networking or ... ???
Thanks for the help.
Ran into the same issue, the workaround worked:
locust --web-host 0.0.0.0 --port 8009
I think it is still an issue, and shouldn't have to explicitly specify localhost.
Here's more info about my system:
Darwin bhutwala-mac 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
I ran into this problem with both in a docker container and on my host macOS machine as well. Both with locust==0.8.1 and locust==0.13.0 with libev 4.33
Interesting @yashbhutwala
Do you have some firewall software installed? Some special networking setup?
It works fine on my Macbook Pro with your exact OS version.
@JulioBarros @yashbhutwala can you show me your firewall settings? (System settings / Security and Integrity / Firewall / Firewall options)
Here are mine, in Swedish :) If I try to run Locust with the default settings I often/always get a firewall opening request popup, but not the issues you're describing.

@cyberw
I don't see any issues with the firewall settings

I have attached the logs here, if they help ๐
[2020-03-23 08:01:31,100] bhutwala-mac/INFO/locust.main: Starting web monitor at *:8089
[2020-03-23 08:01:31,101] bhutwala-mac/INFO/locust.main: Starting Locust 0.13.0
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr: Traceback (most recent call last):
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr: File "src/gevent/greenlet.py", line 766, in gevent._greenlet.Greenlet.run
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/locust/web.py", line 201, in start
pywsgi.WSGIServer((options.web_host, options.port),
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/baseserver.py", line 367, in serve_forever
self.start()
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/baseserver.py", line 305, in start
self.init_socket()
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,179] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/pywsgi.py", line 1491, in init_socket
self.update_environ()
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/pywsgi.py", line 1503, in update_environ
name = socket.getfqdn(address[0])
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/_socketcommon.py", line 269, in getfqdn
hostname, aliases, _ = gethostbyaddr(name)
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/_socketcommon.py", line 241, in gethostbyaddr
return get_hub().resolver.gethostbyaddr(ip_address)
[2020-03-23 08:01:31,180] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,184] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/resolver/thread.py", line 68, in gethostbyaddr
return self.pool.apply(_socket.gethostbyaddr, args, kwargs)
[2020-03-23 08:01:31,184] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,184] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/pool.py", line 159, in apply
return self.spawn(func, *args, **kwds).get()
[2020-03-23 08:01:31,184] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,184] bhutwala-mac/ERROR/stderr: File "src/gevent/event.py", line 268, in gevent._event.AsyncResult.get
[2020-03-23 08:01:31,184] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,185] bhutwala-mac/ERROR/stderr: File "src/gevent/event.py", line 296, in gevent._event.AsyncResult.get
[2020-03-23 08:01:31,185] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,185] bhutwala-mac/ERROR/stderr: File "src/gevent/event.py", line 286, in gevent._event.AsyncResult.get
[2020-03-23 08:01:31,185] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,185] bhutwala-mac/ERROR/stderr: File "src/gevent/event.py", line 266, in gevent._event.AsyncResult._raise_exception
[2020-03-23 08:01:31,186] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,186] bhutwala-mac/ERROR/stderr: File "src/gevent/event.py", line 211, in gevent._event.AsyncResult.exc_info.__get__
[2020-03-23 08:01:31,186] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,186] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/_tblib.py", line 371, in g
return f(a)
[2020-03-23 08:01:31,186] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,186] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/_tblib.py", line 432, in load_traceback
return loads(s)
[2020-03-23 08:01:31,189] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,189] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/_tblib.py", line 337, in unpickle_traceback
return ret.as_traceback()
[2020-03-23 08:01:31,189] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,189] bhutwala-mac/ERROR/stderr: File "/Users/bhutwala/.local/share/virtualenvs/loadgenerator-V00fQKam/lib/python3.8/site-packages/gevent/_tblib.py", line 202, in as_traceback
code = CodeType(
[2020-03-23 08:01:31,189] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,190] bhutwala-mac/ERROR/stderr: TypeError: an integer is required (got type bytes)
[2020-03-23 08:01:31,190] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,190] bhutwala-mac/ERROR/stderr: 2020-03-23T12:01:31Z
[2020-03-23 08:01:31,190] bhutwala-mac/ERROR/stderr:
[2020-03-23 08:01:31,190] bhutwala-mac/ERROR/stderr: <Greenlet at 0x107fe5040: start([<class 'locustfile.WebsiteUser'>], Namespace(csvfilebase=None, exit_code_on_error=1, )> failed with TypeError
[2020-03-23 08:01:31,190] bhutwala-mac/INFO/locust.main: Shutting down (exit code 0), bye.
[2020-03-23 08:01:31,190] bhutwala-mac/INFO/locust.main: Cleaning up runner...
[2020-03-23 08:01:31,190] bhutwala-mac/INFO/locust.main: Running teardowns...
Name # reqs # fails Avg Min Max | Median req/s failures/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
Aggregated 0 0(0.00%) 0.00 0.00
Percentage of the requests completed within given times
Name # reqs 50% 66% 75% 80% 90% 95% 98% 99% 100%
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
Hmmm... I am on python 3.7.7. That is the only difference I see. I do wonder why your firewall options are greyed out though? Are you 110% sure there is no other firewall or maybe corporate policy in place?
Hmmm... I am on python 3.7.7. That is the only difference I see. I do wonder why your firewall options are greyed out though? Are you 110% sure there is no other firewall or maybe corporate policy in place?
Hmm... not a 110% sure... perhaps there is some corporate policy I'm unaware of, I cannot fully discount it.
Other people have reported similar issues with Python 3.8, so it may have something to do with that...
Can you check which version of gevent that you have installed?
using gevent==1.4.0
certifi==2018.11.29 # via requests
chardet==3.0.4 # via requests
click==7.0 # via flask
flask==1.0.2 # via locustio
gevent==1.4.0 # via locustio
greenlet==0.4.15 # via gevent
idna==2.8 # via requests
itsdangerous==1.1.0 # via flask
jinja2==2.10 # via flask
locustio==0.13.0
markupsafe==1.1.0 # via jinja2
msgpack-python==0.5.6 # via locustio
pyzmq==17.0.0 # via locustio
requests==2.21.0 # via locustio
six==1.12.0 # via locustio
urllib3==1.24.1 # via requests
werkzeug==0.14.1 # via flask
Oh. That is very old, and probably the root cause of your issue. Latest locust release depends on 1.5a3.
Most helpful comment
I thought it was always the load balancer? :) At least it was at a company I worked at a long long time ago.
Actually, this was a big hint. It wasn't DNS in the sense of trying to find the server under test. It is/was an issue trying to bind to the web host and port for the UI. If I specify them specifically it works ie.
locust --web-host 0.0.0.0 --port 8889
I don't know if something has gone wacky with my machine or its networking or ... ???
Thanks for the help.