-
Notifications
You must be signed in to change notification settings - Fork 6.3k
fix: support parsing non-seekable proc files #21507
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: support parsing non-seekable proc files #21507
Conversation
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.
Pull request overview
This PR addresses a compatibility issue with recent Linux kernels (6.14 in Ubuntu 24.04 HWE) where certain /proc files have become non-seekable, causing lseek() to fail with ESPIPE or EINVAL errors. This breaks Netdata's network statistics collection which depends on rewinding procfiles between reads.
- Adds a new
PROCFILE_FLAG_NONSEEKABLEflag to track files that don't support seeking - Implements fallback logic in
procfile_readall()to reopen non-seekable files instead of usinglseek() - Optimizes future reads by caching the non-seekable status to avoid repeated failed
lseek()attempts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libnetdata/procfile/procfile.h | Adds the PROCFILE_FLAG_NONSEEKABLE flag definition to identify files that don't support lseek() operations |
| src/libnetdata/procfile/procfile.c | Implements the fallback logic to handle non-seekable files by reopening them instead of seeking, with detection and caching of the non-seekable status |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@cubic-dev-ai review this PR |
@ilyam8 I have started the AI code review. It will take a few minutes to complete. |
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.
No issues found across 2 files
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.
No issues found across 2 files
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request has been mentioned on Netdata Community Forums. There might be relevant details there: |
(cherry picked from commit 68079be)
(cherry picked from commit 68079be)
(cherry picked from commit 68079be)
Summary
Fixes: #21365
Fixes: #21494
Recent Linux kernels (6.14 in Ubuntu 24.04 HWE) changed some
/procfiles to be non-seekable, causinglseek()to fail withESPIPEorEINVAL.This breaks network statistics collection in Netdata as
procfile_readall()depends on rewinding files between reads.The kernel bug has been fixed upstream but hasn't reached all distributions yet.
Test Plan
Additional Information
For users: How does this change affect me?
Summary by cubic
Fix procfile parsing for non-seekable /proc files by reopening instead of seeking, restoring network stats collection on kernels where lseek fails (e.g., Ubuntu 24.04 HWE 6.14). Adds a flag to remember non-seekable files and avoid repeated lseek attempts.
Written for commit ce4ff1c. Summary will update automatically on new commits.