locust: error: argument --master-port: invalid int value bug
Describe the bug
locust: error: argument --master-port: invalid int value: ‘tcp://172.30.44.4:8089’
Expected behavior
Locust runs correctly without producing this error. As --master-port
wasn’t even supplied.
Actual behavior
When invoking locust in master mode using the following: locust -f /scripts/locust-script.py --master
the following error occurs locust: error: argument --master-port: invalid int value: 'tcp://172.30.44.4:8089'
Steps to reproduce
Start locust in the container using the command: locust -f /scripts/locust-script.py --master
Error occurs.
Environment settings
- OS: RHEL
- Python version: Python 3.6 from image registry.redhat.io/rhel8/python-36
- Locust version: Using latest.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 53 (5 by maintainers)
Commits related to this issue
- Give better error message when kubernetes env vars collide with locust's. Helps with #1226. — committed to locustio/locust by cyberw 4 years ago
- Give better error message when kubernetes env vars collide with locust's. Helps with #1226. — committed to locustio/locust by cyberw 4 years ago
This should not happen any more now that we have renamed the env var for master port to LOCUST_MASTER_NODE_PORT (the original issue I mean, some of the followup discussion here might still apply, but that should be a separate ticket)
ahh ok. i see what’s happening; it’s a clash between auto-populated ENV variables that come from creating “Service” objects in k8s. It only clicked now, but naming a Service “locust-master” in k8s results in an environment value that is “LOCUST_MASTER_SERVICE” (and a bunch of other values). And those auto names happen to overlap some of the names that locust looks at.
I’m not sure what the best solution is; documentation could help but that’s always fragile. Obviously short-term I can just just different names for the k8s objects.
Tried with LOCUST_MASTER_HOST and that is where slave is unable to connect master. it gets stuck here INFO/locust.main: Starting Locust 0.14.6. The master pod keeps waiting for the slave to connect.
I’m agreeing with you 😃
Yeah I wouldn’t disable environment variable reading. Using environment variables is a standard (maybe even the standard) scenario in k8s.
I was more meaning that the warning/exception could know for certain that there is a k8s related issue if you see KUBERNETES_SERVICE_HOST and LOCUST_MASTER_PORT is a non-integer.
I’m actually seeing the same thing when trying to launch it in kubernetes. docker_start.sh is resulting in the following output, even if LOCUST_MODE is set to standalone
If I launch a container with kubectl run,
kubectl run shell --rm -i --tty --image locustio/locust:0.13.5 -- ash
and then I can set environment variables and execute docker_start.sh and it’s fine