Skip to content

Conversation

Honny1
Copy link
Member

@Honny1 Honny1 commented Oct 9, 2025

Ignore ENOENT errors during /proc/sys traversal as entries can disappear
between directory enumeration and file access. Continue logging other
errors for investigation.

Fixes: #27252

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Enforce release-note requirement, even if just None labels Oct 9, 2025
Copy link
Contributor

openshift-ci bot commented Oct 9, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Honny1
Once this PR has been reviewed and has the lgtm label, please assign baude for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@Honny1 Honny1 added the No New Tests Allow PR to proceed without adding regression tests label Oct 9, 2025
@Honny1 Honny1 force-pushed the flake-investigation branch from 719fe13 to 1c8664d Compare October 9, 2025 16:28
@Honny1 Honny1 changed the title Investigation podman run --sysctl completion for sysctl test flaky #2… Fix flaky sysctl completion by handling /proc/sys race conditions Oct 9, 2025
@openshift-ci openshift-ci bot added release-note-none and removed do-not-merge/release-note-label-needed Enforce release-note requirement, even if just None labels Oct 9, 2025
@Honny1 Honny1 marked this pull request as ready for review October 9, 2025 16:29
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2025
Ignore ENOENT errors during /proc/sys traversal as entries can disappear
between directory enumeration and file access. Continue logging other
errors for investigation.

Fixes: containers#27252

Signed-off-by: Jan Rodák <[email protected]>
@Honny1 Honny1 force-pushed the flake-investigation branch from 1c8664d to c4ade21 Compare October 9, 2025 16:31
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that sounds about right about the root cause.

var completions []string
sysPath := "/proc/sys"

err := filepath.Walk(sysPath, func(path string, info os.FileInfo, err error) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but we should use WalkDir() as it is more efficient

})

if err != nil {
logrus.Errorf("failed to scan sysctl parameters in %q: %v", sysPath, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not log with logrus in completions, it is somewhat inconsistent and end users will never get to seem than anyway so I am not sure if that does add much value

For completion "logging" cobra provides its own function helper so we should use for consistency if you really want to log this: cobra.CompErrorln() which is what some other function here do

Comment on lines +1986 to 1993
// /proc/sys is a volatile virtual filesystem whose contents can change rapidly.
// Handle race conditions where entries disappear between directory enumeration
// and file access attempts - this is expected behavior in busy CI environments.
// See: https://github.com/containers/podman/issues/27252
if errors.Is(err, fs.ErrNotExist) {
return nil
}
return err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could happen on any system not just in CI, this makes it a bit sounds like we only ignore this because of CI which is not the case as the walking race can always happen.

Also while ignoring ErrNotExist is certainly right do we get anything by reporting other errors, that would still abort the completion and offer no suggestion to end users.
Maybe there is some proc/sys dir not readable as rootless user then this would fail. So I think it would be best to return the special error filepath.SkipDir here to just skip the directory where the error happened and keep searching for more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No New Tests Allow PR to proceed without adding regression tests release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman run --sysctl completion for sysctl test flaky
2 participants