-
Notifications
You must be signed in to change notification settings - Fork 799
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
Portmap plugin is not idempotent if executed in parallel #418
Comments
/cc @dcbw |
I'm able to reproduce it, the problem is executing several
if we create a namespace called If we execute the DEL command sequentially there are no errors: oot@kind-worker2:~# for i in `seq 1 10`; do /cnitool del kindnet /var/run/netns/bob ; done
root@kind-worker2:~# However, if we execute the command in parallel: root@kind-worker2:~# printf %s\\n {0..10} | xargs -n 1 -P 8 /cnitool del kindnet /var/run/netns/bob
could not teardown ipv4 dnat: running [/usr/sbin/iptables -t nat -X CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: iptables: No chain/target/match by that name.
could not teardown ipv4 dnat: running [/usr/sbin/iptables -t nat -F CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: iptables: No chain/target/match by that name.
could not teardown ipv6 dnat: running [/usr/sbin/ip6tables -t nat -X CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: ip6tables: No chain/target/match by that name.
could not teardown ipv6 dnat: running [/usr/sbin/ip6tables -t nat -X CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: ip6tables: No chain/target/match by that name.
could not teardown ipv6 dnat: running [/usr/sbin/ip6tables -t nat -X CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: ip6tables: No chain/target/match by that name.
could not teardown ipv4 dnat: running [/usr/sbin/iptables -t nat -F CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: iptables: No chain/target/match by that name.
could not teardown ipv4 dnat: running [/usr/sbin/iptables -t nat -X CNI-DN-061b764d9409d70dcee31 --wait]: exit status 1: iptables: No chain/target/match by that name. |
Should portmap implement some way of modifying the iptables rules atomically? |
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instanciation deleting the chains. This patch does that the portmap plugin doesn't fail if the errors is because the chain doesn't exist on teardon. xref: containernetworking#418
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
ideally I think that we should use iptables-restore like in k8s or add an external locking mechanism like iptables with xtables.lock |
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
It turns out that the portmap plugin is not idempotent if its executed in parallel. The errors are caused due to a race of different instantiations deleting the chains. This patch does that the portmap plugin doesn't fail if the errors are because the chain doesn't exist on teardown. xref: containernetworking#418 Signed-off-by: Antonio Ojea <[email protected]>
Someday it'd be nice to migrate to iptables-restore, but that's a lot of work. |
closed by #421 |
KIND is running e2e kubernetes jobs in parallel, creating a test environment with high load creating and deleting pods and services constantly. It uses containerd as CRI
It brought my attention that despite the tests are passing there are a considerable number of errors like this (happening in ipv4 and ipv6 jobs, it's independent of the cluster ip family):
However, my understanding from the portmap plugin code is that this operations should be idempotent and not fail
plugins/plugins/meta/portmap/portmap.go
Line 345 in 6551165
After investigating during some time, I think that the problem maybe caused because there are several several
teardowns
operations in parallel, don't know if this is the expected behaviour in containerd (cc: @Random-Liu ):It can be possible that there is a race here?
plugins/plugins/meta/portmap/chain.go
Line 69 in 6551165
xref: https://storage.googleapis.com/kubernetes-jenkins/logs/ci-kubernetes-kind-conformance-ipv6/1202166066160078851/artifacts/logs/kind-worker/containerd.log
xref: https://storage.googleapis.com/kubernetes-jenkins/logs/ci-kubernetes-kind-conformance-parallel/1202398984073646081/artifacts/logs/kind-worker/containerd.log
The text was updated successfully, but these errors were encountered: