Locust: 【Question】"Address family not supported by protocol" when start the test

Created on 28 Feb 2017  ·  4Comments  ·  Source: locustio/locust

Hi,the tool is awesome,but when I use it on Linux,I've come across some problems.
I think it caused by some config of hostname/ip,but I don't know how to fix it.

my environment: centos 6.5, python 2.7.12, locust 0.8a2。

when I run locust -f **.py, I got this:

[2017-02-28 18:39:42,930] vpc-25hpdepr6/INFO/locust.main: Starting web monitor at *:8089
[2017-02-28 18:39:42,931] vpc-25hpdepr6/INFO/locust.main: Starting Locust 0.8a2
[2017-02-28 18:39:42,933] vpc-25hpdepr6/ERROR/stderr: Traceback (most recent call last):
[2017-02-28 18:39:42,934] .vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/greenlet.py", line 536, in run
[2017-02-28 18:39:42,934] vpc-25hpdepr6/ERROR/stderr: result = self._run(*self.args, **self.kwargs)
[2017-02-28 18:39:42,934] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/web.py", line 211, in start
[2017-02-28 18:39:42,934] .vpc-25hpdepr6/ERROR/stderr: wsgi.WSGIServer((options.web_host, options.port), app, log=None).serve_forever()
[2017-02-28 18:39:42,934] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/baseserver.py", line 360, in serve_forever
[2017-02-28 18:39:42,934] vpc-25hpdepr6/ERROR/stderr: self.start()
[2017-02-28 18:39:42,934] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/baseserver.py", line 304, in start
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: self.init_socket()
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/pywsgi.py", line 1451, in init_socket
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: StreamServer.init_socket(self)
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/server.py", line 127, in init_socket
[2017-02-28 18:39:42,935] .vpc-25hpdepr6/ERROR/stderr: self.socket = self.get_listener(self.address, self.backlog, self.family)
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/server.py", line 138, in get_listener
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: return _tcp_listener(address, backlog=backlog, reuse_addr=cls.reuse_addr, family=family)
[2017-02-28 18:39:42,935] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/server.py", line 224, in _tcp_listener
[2017-02-28 18:39:42,936] vpc-25hpdepr6/ERROR/stderr: sock = socket(family=family)
[2017-02-28 18:39:42,936] vpc-25hpdepr6/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/_socket2.py", line 107, in __init__
[2017-02-28 18:39:42,936] vpc-25hpdepr6/ERROR/stderr: self._sock = _realsocket(family, type, proto)
[2017-02-28 18:39:42,936] vpc-25hpdepr6/ERROR/stderr: error: [Errno 97] **Address family not supported by protocol**
[2017-02-28 18:39:42,936]vpc-25hpdepr6/ERROR/stderr: Tue Feb 28 18:39:42 2017
[2017-02-28 18:39:42,936] vpc-25hpdepr6/ERROR/stderr: 
[2017-02-28 18:39:42,936] .vpc-25hpdepr6/ERROR/stderr: <Greenlet at 0x7f5627612a50: start([<class 'qs2.WebsiteUser'>], <Values at 0x7f5627589f38: {'locustfile': '/home/l)> failed with error
[2017-02-28 18:39:42,936] .vpc-25hpdepr6/INFO/locust.main: Shutting down (exit code 0), bye.

Most helpful comment

What happens if you try to specify the --web-host option manually?

You could try with:

locust --web-host=127.0.0.1
locust --web-host=0.0.0.0
locust --web-host=localhost

All 4 comments

What happens if you try to specify the --web-host option manually?

You could try with:

locust --web-host=127.0.0.1
locust --web-host=0.0.0.0
locust --web-host=localhost

It's worked out very well, Many thanks!

Hi @heyman
Why does specify "--web-host" solve the problem?
When I deploy my code on minishift, everything works fine. When I deploy it on OpenShift in production, I face this Errno 97 problem. I followed your instructions to set --web-host=localhost or 127.0.0.1. With this specified, web ui doesn't work. However, web ui works for --web-host=0.0.0.0
Any reasons? Thanks!

@zhukaisjtu --web-host 127.0.0.1 makes the web UI only listen for connections from localhost, while setting it to 0.0.0.0 makes it listen to all interfaces. As to the original issue, I'm not really sure of the cause, but I'm guessing it's related to IPv6.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bretrouse picture bretrouse  ·  4Comments

max-rocket-internet picture max-rocket-internet  ·  3Comments

YannickXiong picture YannickXiong  ·  3Comments

dolohow picture dolohow  ·  3Comments

gboorse picture gboorse  ·  3Comments