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

ipv6 issues with ECS Service Connect #2979

Open
2 tasks done
brncsk opened this issue Nov 11, 2024 · 7 comments
Open
2 tasks done

ipv6 issues with ECS Service Connect #2979

brncsk opened this issue Nov 11, 2024 · 7 comments
Labels

Comments

@brncsk
Copy link

brncsk commented Nov 11, 2024

Prerequisites

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

@brncsk brncsk added the bug label Nov 11, 2024
@cyberw
Copy link
Collaborator

cyberw commented Nov 11, 2024

Did this use to work before @nc-marco 's change?

@brncsk
Copy link
Author

brncsk commented Nov 11, 2024

@cyberw I don't know, but if there's a specific version I should try, please let me know.

@nc-marco
Copy link

nc-marco commented Nov 11, 2024 via email

@cyberw
Copy link
Collaborator

cyberw commented Nov 11, 2024

Marco's fix was introduced in 2.32.0, so you can try the one just before, which is 2.31.8

@brncsk
Copy link
Author

brncsk commented Nov 11, 2024

Sure, thanks both of you for the heads up – I'll try 2.31.8 and report back later!

@thaurelia
Copy link

Chiming in because I'm also using Locust with ECS + Service Connect and I've been following the original #2787

The pre-2.32 Locust versions that had IPv6 support for ZMQ communication didn't work; I've built a custom Locust version based on 2.29.2 by patching out IPv6 support from locust/rpc/zmqrpc.py to bypass the issue.

So 2.31.8 probably doesn't work either in this scenario.

@cyberw
Copy link
Collaborator

cyberw commented Dec 5, 2024

I'm open for anything, including disabling IPv6 if ECS env vars are set (e.g. ECS_CONTAINER_METADATA_URI is supposedly always set?), but someone else has to build it :)

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

No branches or pull requests

4 participants