-
Notifications
You must be signed in to change notification settings - Fork 798
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 doesn't fail if chain doesn't exist #421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 93 in chain.go if err := ipt.Delete(c.table, entryChain, chainParts...); err != nil {
should be idempotent.
Do you mean that I should check if there is an error of non existent chain and swallow it? |
Yes, that's what I want, and if you could print errs in test, I believe we will locate the root cause exactly. |
I've already found the root cause in #418, and It's easy to reproduce #418 (comment) You can see that it always fail in those lines, however, you are right and I've found a small percentage of time that fails in the line you mention |
5c26296
to
5ccae34
Compare
@mars1024 PTAL, I added your suggestions and it's working now, I can't reproduce the problem EDIT it failed in the CI :/, adding logging to the test EDIT2 this is the failure
|
91c31ea
to
8a57c17
Compare
@squeed please take look to current PR
the xtables lock message makes that fails to parse correctly the error message, thus it doesn't swallow the error Should I submit a new patch to go-iptables to consider this scenario? add it to current PR? or is it ok submitting the PR as it is now? |
Use a Describe container for the It code block of the portmap port forward integration test. 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. Signed-off-by: Antonio Ojea <[email protected]>
8a57c17
to
3603738
Compare
Thanks for your efforts, almost LGTM, and I think it's better to squash some lines into some idempotent utility functions in |
f0f80fd
to
db6896c
Compare
Yes, please! Though, I'm surprised that's failing. It should wait indefinitely. (I have merge rights in go-iptables too). |
Add the following idempotent functions to iptables utils: DeleteRule: idempotently delete an iptables rule DeleteChain: idempotently delete an iptables chain ClearChain: idempotently flush an iptables chain Signed-off-by: Antonio Ojea <[email protected]>
db6896c
to
bf8f171
Compare
@aojea I've released go-iptables, can you pick that up in this PR? |
6f7fd90
to
06c8277
Compare
@squeed here you go, go-iptables upgraded to 0.4.4 with the last changes Is it possible to release a new CNI version? |
lgtm! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm, thanks!
/hold @squeed @mars1024 there is a bug in the go-iptables code I've introduced, my apologies, we need to bump the iptables code again |
bump the go-iptables module to v0.4.5 to avoid concurrency issues with the portmap plugin and errors related to iptables not able to hold the lock. Signed-off-by: Antonio Ojea <[email protected]>
06c8277
to
5a02c5b
Compare
/hold cancel updated the go-iptables dependency to 0.4.5 with the fix |
/lgtm for the newest push |
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: #418
Signed-off-by: Antonio Ojea [email protected]