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

fix(k8smeta): handle missing directories/files during /proc scan #538

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

alacuku
Copy link
Member

@alacuku alacuku commented Nov 7, 2024

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area plugins

/area registry

/area build

/area documentation

What this PR does / why we need it:
std::filesystem::directory_iterator works by retrieving entries on the fly as it iterates over them,
rather than preloading all entries. This implies that entries could indeed disappear (or appear)
between iterations, especially in highly dynamic directories such as /proc/.
The loop continues processing other entries even if an exception occurs,
allowing for robust and uninterrupted iteration.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

std::filesystem::directory_iterator works by retrieving entries on-the-fly as it iterates over them,
rather than preloading all entries. This implies that entries could indeed disappear (or appear)
between iterations, especially in highly dynamic directories such as /proc/.
The loop continues processing other entries even if an exception occurs,
allowing for robust and uninterrupted iteration.

Signed-off-by: Aldo Lacuku <[email protected]>
Copy link

github-actions bot commented Nov 7, 2024

Rules files suggestions

@poiana poiana added the lgtm label Nov 7, 2024
@poiana
Copy link
Contributor

poiana commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alacuku, leogr

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

@poiana
Copy link
Contributor

poiana commented Nov 7, 2024

LGTM label has been added.

Git tree hash: 0e21d6361500972a123577e6c437e1958049d968

@poiana poiana added the approved label Nov 7, 2024
@poiana poiana merged commit 8aeeaa5 into falcosecurity:main Nov 7, 2024
13 of 14 checks passed
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