Search code examples
locust

Locust: unexpected keyword argument 'user_count'


I have a locust test that terminates successfully with all of the environment.stats that I specify being met. Nevertheless, something is causing locust to end with code 2.

Here is the final output.

Note: the kill pid is a separate process that just goes and gets Windows Perf Counter data, not related to locust.

[2021-09-22 14:30:43,061] ILGUYL-LT1/ERROR/root: Uncaught exception in event handler:
Traceback (most recent call last):
  File "c:\git\xxx\venv\lib\site-packages\locust\event.py", line 40, in fire
    handler(**kwargs)
TypeError: on_spawning_complete() got an unexpected keyword argument 'user_count'



[2021-09-22 13:58:05,889] xxx-LT1/INFO/locust.runners: 90 Users have been stopped, 0 still running
kill pid:  21068
[2021-09-22 13:58:05,893] xxx-LT1/INFO/locust.main: Running teardowns...
[2021-09-22 13:58:05,895] xxx-LT1/INFO/locust.main: Shutting down (exit code 2), bye.
[2021-09-22 13:58:05,896] xxx-LT1/INFO/locust.main: Cleaning up runner...
 Name                                                          # reqs      # fails  |     Avg     Min     Max  Median  |   req/s failures/s
--------------------------------------------------------------------------------------------------------------------------------------------
 POST /aesFull.asp                                              10790    11(0.10%)  |    1950      11   19219    1500  |   38.19    0.04
--------------------------------------------------------------------------------------------------------------------------------------------
 Aggregated                                                     10790    11(0.10%)  |    1950      11   19219    1500  |   38.19    0.04

Response time percentiles (approximated)
 Type     Name                                                              50%    66%    75%    80%    90%    95%    98%    99%  99.9% 99.99%   100% # reqs
--------|------------------------------------------------------------|---------|------|------|------|------|------|------|------|------|------|------|------|
 POST     /aesFull.asp                                                     1500   2100   2500   2700   3800   5100   7700  10000  17000  19000  19000  10790
--------|------------------------------------------------------------|---------|------|------|------|------|------|------|------|------|------|------|------|
 None     Aggregated                                                       1500   2100   2500   2700   3800   5100   7700  10000  17000  19000  19000  10790

Error report
 # occurrences      Error
--------------------------------------------------------------------------------------------------------------------------------------------
 7                  POST /aesFull.asp: CatchResponseError('xxx response has no xxx ID, possibly non-valid input')
 4                  POST /aesFull.asp: CatchResponseError('xxxxx response code error')
--------------------------------------------------------------------------------------------------------------------------------------------

On further investigation, found at the very top of the long log output an unhandled exception.


Solution

  • Fixed.

    I had inserted a @events.spawning_complete.add_listener listener that was ill-defined (no arguments).

    I removed it, and the problem went away.