Run failure due to iptables xtables lock contention #44331
Labels
area/networking
kind/bug
Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
Description
We're seeing contention in a CI environment where the following message is often encountered leading to failures:
The source of that error message is endpoint.sbJoin in libnetwork/endpoint.go. It calls:
iptable.raw
callsiptables
with--wait
if supported, butiptable.existsRaw
does not. The invocation of iptables in existsRaw has not changed since 2017 but how OSes behave has.I've created a simple test to determine if iptables locking behavior has changed when calling
iptables -S
which is what is invoked iniptable.existsRaw()
across several releases of Ubuntu (as we've updated from bionic to focal)Here is the test file, it takes an exclusive lock and then invokes
iptables -S
with and without--wait
We can build images for Ubuntu bionic, focal, and jammy to see how this behaves:
Ubuntu Bionic Behavior
Summary: iptables waits for the xtables lock without the
--wait
flag and is successful. Adding--wait
is also successful but is noisy as it waits for the lock.Ubuntu Focal Behavior
Summary: Without the
--wait
flag the command returns an error immediately, which is what we have observed. Adding--wait
makes this successful.Ubuntu Jammy Behavior
Summary: Without the
--wait
flag the call is successful and returns immediately. Adding the--wait
performs the same.Reproduce
Concurrent docker runs on Ubuntu Focal can result in failure due to iptables lock contention mapping container ports in the host OS depending on timing.
Expected behavior
Docker should wait for the iptables lock when looking at the exiting rules to avoid this failure.
docker version
docker info
Additional Info
The docker info is from my machine running Ubuntu Jammy, not CI where we're running Bionic and running into this issue, sorry.
The text was updated successfully, but these errors were encountered: