Skip to content
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

pkg/netns: add 60s timeout #2239

Merged
merged 2 commits into from
Nov 8, 2024
Merged

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Nov 8, 2024

pkg/netns: do not loop forever

So this is not so simple as one thinks, apparently there are cases where
it is impossible to remove the file but umount() worked fine...
We fixed one issue that ran into this[1] but there seems to be
another[2] problem, unknown cause yet.

Regardless of the real fix for issue[2] add a timeout to not hang/loop
forever. If we were not able to remove the file after 60s give up and
print an error. Leaking these files is not great as the netns references
stay around but it will not prevent containers from running. It will
only start leaking resources.

[1] https://issues.redhat.com/browse/RHEL-59620
[2] containers/podman#24487

Removing one level of nesting with a early return.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
So this is not so simple as one thinks, apparently there are cases where
it is impossible to remove the file but umount() worked fine...
We fixed one issue that ran into this[1] but there seems to be
another[2] problem, unknown cause yet.

Regardless of the real fix for issue[2] add a timeout to not hang/loop
forever. If we were not able to remove the file after 60s give up and
print an error. Leaking these files is not great as the netns references
stay around but it will not prevent containers from running. It will
only start leaking resources.

[1] https://issues.redhat.com/browse/RHEL-59620
[2] containers/podman#24487

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Copy link
Contributor

openshift-ci bot commented Nov 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Nov 8, 2024
@Luap99
Copy link
Member Author

Luap99 commented Nov 8, 2024

@mheon @baude @TomSweeneyRedHat PTAL, I would like to get this in before the release cut here to at least avoid the infinitive loop

@rhatdan
Copy link
Member

rhatdan commented Nov 8, 2024

LGTM

I never saw the for range 6000 command before.

@TomSweeneyRedHat
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

@rhatdan I'd to dig the range {int} up too, neat change, just happened in Feb 2024. It only took Go 12 years to include it after it was requested.

@rhatdan
Copy link
Member

rhatdan commented Nov 8, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 8, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit c174769 into containers:main Nov 8, 2024
16 checks passed
@Luap99 Luap99 deleted the unmount-netns branch November 8, 2024 16:36
@Luap99
Copy link
Member Author

Luap99 commented Nov 8, 2024

Yeah the range over int is new and nice and was added for go 1.22, but if you want to see the actual crazy stuff in go 1.23 added a new iterator syntax https://pkg.go.dev/iter#hdr-Iterators so no you can loop over anything that implements an iterator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants