alexei-led / pumba

Chaos testing, network emulation, and stress testing tool for containers
Apache License 2.0
2.75k stars 193 forks source link

"netem delay" does not work on Windows #254

Closed xuyangm closed 7 months ago

xuyangm commented 11 months ago

Hi, this app is great! I met an issue when I used it in my Windows computer. I ran two containers on this computer. c07a7466e40b ipfs/go-ipfs:latest "/sbin/tini -- /usr/…" 9 minutes ago Up 9 minutes (healthy) 4001/udp, 8081/tcp, 0.0.0.0:10001->4001/tcp, 0.0.0.0:11001->5001/tcp, 0.0.0.0:12001->8080/tcp ipfs-node-2 0bd424928d3c ipfs/go-ipfs:latest "/sbin/tini -- /usr/…" 10 minutes ago Up 10 minutes (healthy) 4001/udp, 8081/tcp, 0.0.0.0:10000->4001/tcp, 0.0.0.0:11000->5001/tcp, 0.0.0.0:12000->8080/tcp ipfs-node-1

Then I use the following command to add delay to each container. docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock gaiaadm/pumba netem --duration 5m --tc-image gaiadocker/iproute2 delay --time 3000 ipfs-node-1 docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock gaiaadm/pumba netem --duration 5m --tc-image gaiadocker/iproute2 delay --time 3000 ipfs-node-2

However, when I entered one container to ping another container. The delay does not change. It remains several milliseconds.

After that, I did the same test on my Linux computer. Pumba works very well, so I doubt this is due to different systems. How can I fix this problem? Thank you in advance.

xuyangm commented 11 months ago

Update: I solved this by closing "using WSL2 based engine". Although I don't know why this option will cause such an issue, it works normally now. I really appreciate if someone can tell me the reason.

alexei-led commented 11 months ago

Pumba uses tc (Linux traffic control) to simulate network issues. Probably it does not work as expected on Windows before WSL2

pat-git commented 7 months ago

Hello @xuyangm, what do you mean by "by closing "using WSL2 based engine"". For me it's not working with WSL2 (Ubuntu 20.04), what did you do to solve this issue?

alexei-led commented 7 months ago

No plans fixing this issue for Windows. 100% of Pumba functionality is available for Linux only.

deanwilson-payroc commented 6 months ago

Hello @xuyangm, what do you mean by "by closing "using WSL2 based engine"". For me it's not working with WSL2 (Ubuntu 20.04), what did you do to solve this issue?

I was wondering this too but found that they were talking about an option in docker desktop to not use the WSL2 based engine (i.e. use hyper-v)

This does seem to fix it but with the downside of not being able to use it in your wsl-2 instance