Description
Prerequisites
- I am using the latest version of Locust
- I am reporting a bug, not asking a question
Description
Locust workers cannot connect to the master if both are run in ECS tasks connected by ECS Service Connect.
Service Connect injects both the master container's v4 and v6 addresses into /etc/hosts
, which I reckon tells locust to use IPv6 as described in #2923:
127.0.0.1 localhost
x.x.x.x ip-x-x-x-x.eu-central-1.compute.internal
127.255.0.1 master.locust.local
2600:f0f0:0:0:0:0:0:1 master.locust.local
However this does not work because some part of the stack does not support IPv6 (I never managed to determine which part, exactly).
I tried disabling IPv6 on the kernel level, so that sysctl net.ipv6.conf.all.disable_ipv6
does report back 1
– but it's still not working.
A workaround is to remove the problematic line in a custom entrypoint script:
# Remove the ipv6 line from /etc/hosts pointing to `master.locust.local`
# (cannot directly write the hostsfile as it's mounted by docker)
cp /etc/hosts /etc/hosts.bak
sed -i '/:1 master.locust.local/d' /etc/hosts.bak
cp /etc/hosts.bak /etc/hosts
Command line
N/A
Locustfile contents
# N/A
Python version
Python 3.11.10
Locust version
2.32.2
Operating system
Linux ip-x-x-x-x.eu-central-1.compute.internal 5.10.226-214.880.amzn2.x86_64 #1 SMP Tue Oct 8 16:18:15 UTC 2024 x86_64 GNU/Linux