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

Locust master UI fails when refreshing on second test #2376

Closed
ness-alexandru-bujdei opened this issue Jul 31, 2023 · 6 comments
Closed

Locust master UI fails when refreshing on second test #2376

ness-alexandru-bujdei opened this issue Jul 31, 2023 · 6 comments

Comments

@ness-alexandru-bujdei
Copy link

Describe the bug

When refreshing the locust UI on the second run test, it goes into Internal Server Error.

Expected behavior

The Locust UI to load

Actual behavior

Internal Server Error

Steps to reproduce

  1. Run Locust with the Web UI on and multiple options in the UserClasses selector
  2. Run a test (let's say for one minute)
  3. Stop the test
  4. Start another test
  5. Refresh the page

Extra info

I'm not using a config file, everything is passed down through env vars.
I'm using locust_plugins and sending data to timescale.
I also have LOCUST_PLAYWRIGHT=1 on because of SvenskaSpel/locust-plugins#104

Environment

  • OS: Linux (Docker image deployed in kubecluster)
  • Python version: 3.10
  • Locust version: 2.15.1
  • Locust command line that you ran:
  • Locust file contents (anonymized if necessary):
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/gevent/pywsgi.py", line 988, in handle_one_response

self.run_application()
File "/opt/venv/lib/python3.10/site-packages/gevent/pywsgi.py", line 934, in run_application

self.result = self.application(self.environ, self.start_response)
File "/opt/venv/lib/python3.10/site-packages/flask/app.py", line 2213, in __call__

return self.wsgi_app(environ, start_response)
File "/opt/venv/lib/python3.10/site-packages/flask/app.py", line 2193, in wsgi_app

response = self.handle_exception(e)
File "/opt/venv/lib/python3.10/site-packages/flask_cors/extension.py", line 165, in wrapped_function

return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/opt/venv/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app

response = self.full_dispatch_request()
File "/opt/venv/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request

rv = self.handle_user_exception(e)
File "/opt/venv/lib/python3.10/site-packages/flask_cors/extension.py", line 165, in wrapped_function

return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/opt/venv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request

rv = self.dispatch_request()
File "/opt/venv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request

return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/opt/venv/lib/python3.10/site-packages/locust/web.py", line 505, in wrapper

return view_func(*args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/locust/web.py", line 141, in index

self.update_template_args()
File "/opt/venv/lib/python3.10/site-packages/locust/web.py", line 534, in update_template_args

extra_options = argument_parser.ui_extra_args_dict()
File "/opt/venv/lib/python3.10/site-packages/locust/argument_parser.py", line 625, in ui_extra_args_dict

locust_args = default_args_dict()
File "/opt/venv/lib/python3.10/site-packages/locust/argument_parser.py", line 610, in default_args_dict

default_parser = get_empty_argument_parser()
File "/opt/venv/lib/python3.10/site-packages/locust/argument_parser.py", line 141, in get_empty_argument_parser

parser = LocustArgumentParser(
File "/opt/venv/lib/python3.10/site-packages/configargparse.py", line 433, in __init__

argparse.ArgumentParser.__init__(self, *args, **kwargs)
File "/usr/local/lib/python3.10/argparse.py", line 1717, in __init__

prog = _os.path.basename(_sys.argv[0]) 
IndexError: list index out of range
2023-07-31T09:50:41Z {'REMOTE_ADDR': '::ffff:10.0.4.14', 'REMOTE_PORT': '41846', 'HTTP_HOST': '10.0.7.195:8089', (hidden keys: 21)} failed with IndexError

requirements.txt:

dataclasses-json==0.5.12
python-dotenv==1.0.0
paho-mqtt==1.6.1
locust-plugins==3.3.1
httpcore==0.17.2
requests~=2.31.0
locust~=2.15.1
gevent==23.7.0
Flask~=2.3.2
urlexpander~=0.0.37
@cyberw
Copy link
Collaborator

cyberw commented Jul 31, 2023

what is your complete command line (and env vars)? and your locust file? of particular interest is if you have defined any custom arguments there.

@ness-alexandru-bujdei
Copy link
Author

hi,
I've managed to isolate this I think.
It occurs when LOCUST_TIMECALE=1 alongside PGHOST,PGPORT,PGUSER,PGPASSWORD are present in my env vars.
(I'm trying to run in UI mode while also streaming data to Timescale)
Should I open this up again in https://github.com/SvenskaSpel/locust-plugins ?

@cyberw I hope to find the time sometime this week to make a simple project that can simulate the issues properly.
Unfortunately, I'm working on a project with many env vars and configurations and it's pretty hard to share the entire context.
Thanks!

@cyberw
Copy link
Collaborator

cyberw commented Aug 1, 2023

Which version of configargparse do you have?

@cyberw
Copy link
Collaborator

cyberw commented Aug 1, 2023

Ah. I found the root cause (in locust-plugins). Will make a fix soon.

cyberw added a commit to SvenskaSpel/locust-plugins that referenced this issue Aug 1, 2023
…-modify-sys.argv

Dashboards: Dont accidentally modify sys.argv. Fixes locustio/locust#2376
@cyberw
Copy link
Collaborator

cyberw commented Aug 1, 2023

Should be fixed now. Available in locust-plugins as version 3.4.2 in a couple minutes, let me know if it works.

Marking this as invalid, because issue was not in this repo (so I dont want it included in locust release notes). Thanks for reporting!

@cyberw cyberw added the invalid label Aug 1, 2023
@ness-alexandru-bujdei
Copy link
Author

@cyberw wow! many thanks! I spent the morning creatig a simple project to reproduce the issue. Just as I was about to push it to github I saw your message from yesterday!
I confirm the fix is ✅ and now it all works on my side!

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

No branches or pull requests

2 participants