Skip to content

Conversation

@khpeet
Copy link

@khpeet khpeet commented Nov 18, 2025

Description

Added logic to suppress repeated error logs due to file permission errors within the filelog receiver.

  • Updated makeFingerprint to check for permission errors via os.isPermission
  • Log an error only on the first occurrence for a given file path and add it to an in-memory map, guarded by a mutex to avoid race conditions for concurrent read/writes.
  • Debug log only for subsequent read attempt (to avoid spam)
  • When the file becomes readable, info log a message and remove the path from the stored set

Link to tracking issue

Fixes #39491

Testing

New unit test verifying:

  • First unreadable-open produces exactly one Error-level log.
  • Second attempt does not produce another Error-level log.
  • When permissions are restored, an Info-level Previously unreadable... message appears.

NOTE: Test skips Windows due to unreliable os.Chmod behavior

Documentation

Added changelog yaml entry summarizing the issue and fix.

@khpeet khpeet requested review from a team and andrzej-stencel as code owners November 18, 2025 13:27
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 18, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: khpeet / name: Keagan Peet (993e8b0)

@github-actions github-actions bot added the first-time contributor PRs made by new contributors label Nov 18, 2025
@github-actions
Copy link
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

@khpeet khpeet requested a review from atoulme November 19, 2025 21:26
@khpeet
Copy link
Author

khpeet commented Nov 24, 2025

@andrzej-stencel @atoulme - gentle bump on this PR

Copy link
Contributor

@VihasMakwana VihasMakwana left a comment

Choose a reason for hiding this comment

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

Do we need a mutex? AFAIK, calls to makeFingerprint are serialised. Could you confirm this?

Also, @andrzej-stencel is on sick leave until starting of December. It might take some time to get this merged.

@khpeet
Copy link
Author

khpeet commented Nov 25, 2025

Do we need a mutex? AFAIK, calls to makeFingerprint are serialised. Could you confirm this?

Also, @andrzej-stencel is on sick leave until starting of December. It might take some time to get this merged.

Hey @VihasMakwana - You are correct! Taking a second deeper look, I saw that only a single goroutine calls poll() and everything looks sequential. I've removed the mutex.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

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.

Repeated and frequent "Failed to open file" on a file it can't read.

5 participants