locustio / locust

Write scalable load tests in plain Python 🚗💨
MIT License
24.64k stars 2.96k forks source link

Locust 0.9.0 slave TypeError: __init__() takes exactly 1 argument (2 given) #887

Closed csgcp closed 6 years ago

csgcp commented 6 years ago

Using Locust 0.9.0. When a locust slave is hatched, there is a TypeError

mbp: locust --host=deleted --slave --master-host=127.0.0.1
[2018-09-17 13:36:12,199] mbp/INFO/locust.main: Starting Locust 0.9.0
[2018-09-17 13:36:31,279] mbp/INFO/locust.runners: Hatching and swarming 1 clients at the rate 1 clients/s...
[2018-09-17 13:36:31,280] mbp/ERROR/stderr: Traceback (most recent call last):
[2018-09-17 13:36:31,281] mbp/ERROR/stderr: File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
[2018-09-17 13:36:31,281] mbp/ERROR/stderr: File "/Users/deleted/locust/src/locustio/locust/runners.py", line 114, in start_locust
[2018-09-17 13:36:31,281] mbp/ERROR/stderr: locust().run(runner=self)
[2018-09-17 13:36:31,281] mbp/ERROR/stderr: File "/Users/deleted/locust/src/locustio/locust/core.py", line 158, in run
[2018-09-17 13:36:31,282] mbp/ERROR/stderr: task_set_instance = self.task_set(self)
[2018-09-17 13:36:31,282] mbp/ERROR/stderr: TypeError: __init__() takes exactly 1 argument (2 given)
[2018-09-17 13:36:31,283] mbp/ERROR/stderr: 2018-09-17T17:36:31Z
[2018-09-17 13:36:31,283] mbp/ERROR/stderr: 
[2018-09-17 13:36:31,283] mbp/ERROR/stderr: <Greenlet "Greenlet-0" at 0x103d9b470: start_locust(<class 'locustfile.WebsiteUser'>)> failed with TypeError
[2018-09-17 13:36:32,284] mbp/INFO/locust.runners: All locusts hatched: WebsiteUser: 1

The test is then stuck - none of the simulated users perform any tasks.

The master was started as follows. locust --host=deleted --master

The issue occurs whether using the UI or --no-web options.

The issue does NOT occur when master/slave is NOT used, for example, this produces no errors: locust --host=deleted --no-web -c 1 -r 1

Environment is Mac OSX HIgh Sierra 10.13.6 with Python 2.7.14 (reference in the the first line of the locust script file is #!/usr/local/opt/python@2/bin/python2.7)

csgcp commented 6 years ago

Issue resolved after changes to local environment. Known changes:

  1. Point /usr/local/bin/python to python3
  2. Added print statements to core.py forcing recomplile to new .pyc