-
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
idempotent portmap teardown #420
Conversation
d8e28fc
to
4fb7b7f
Compare
/assign @dcbw @danwinship |
3cfa6c3
to
b07022f
Compare
e3b6765
to
599d4fc
Compare
Use a cross-proces mutex based in a lock file to make the teardown portmap function idempotent. The teardown portmap function is not idempotent if it is executed in parallel because it has concurrency issues modifying the iptables rules. Signed-off-by: Antonio Ojea <[email protected]>
"github.com/mattn/go-shellwords" | ||
) | ||
|
||
const lockfile = "/tmp/portmap.lock" |
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.
is this the right approach?
615f3a7
to
185988b
Compare
Related PR #408 |
I've added a test to the PR that verifies the idempotency if there are concurrent executions. |
Do you have the old PR branch which I can take a look at? IMO, global locker should be our last choice, but I believe it will work. |
/cc @squeed |
/close in favor of #421 |
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 iptables executions deleting the chains.
This patch adds a mutex based in a file lock that solves the concurrency problems.
xref: #418