Skip to content

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Dec 27, 2025

Summary

Fixes: #21365
Fixes: #21494

Recent Linux kernels (6.14 in Ubuntu 24.04 HWE) changed some /proc files to be non-seekable, causing lseek() to fail with ESPIPE or EINVAL.

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
  • Installed on Ubuntu 24.04 with 6.14.0-37-generic kernel. Network stats collected.
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.

  • Bug Fixes
    • Detect ESPIPE/EINVAL from lseek in procfile_readall and set PROCFILE_FLAG_NONSEEKABLE.
    • When flagged, skip lseek and reopen to reset position; behavior unchanged for seekable files.

Written for commit ce4ff1c. Summary will update automatically on new commits.

Copy link
Contributor

Copilot AI left a 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_NONSEEKABLE flag to track files that don't support seeking
  • Implements fallback logic in procfile_readall() to reopen non-seekable files instead of using lseek()
  • 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.

@ilyam8 ilyam8 marked this pull request as ready for review December 27, 2025 17:51
@ilyam8
Copy link
Member Author

ilyam8 commented Dec 27, 2025

@cubic-dev-ai review this PR

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Dec 27, 2025

@cubic-dev-ai review this PR

@ilyam8 I have started the AI code review. It will take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

@ilyam8 ilyam8 enabled auto-merge (squash) December 27, 2025 21:13
@ilyam8 ilyam8 requested review from stelfrag and removed request for thiagoftsm and vkalintiris December 28, 2025 09:57
Copy link
Contributor

Copilot AI left a 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.

@ilyam8 ilyam8 changed the title fix: add procfile parsing for non-seekable files fix: support parsing non-seekable procfile files Dec 28, 2025
@ilyam8 ilyam8 merged commit 68079be into netdata:master Dec 28, 2025
123 checks passed
@ilyam8 ilyam8 deleted the fix-procfile-parsing-nonseekable branch December 28, 2025 19:45
@ilyam8 ilyam8 changed the title fix: support parsing non-seekable procfile files fix: support parsing non-seekable proc files Dec 28, 2025
@netdata-community-bot
Copy link

This pull request has been mentioned on Netdata Community Forums. There might be relevant details there:

https://community.netdata.cloud/t/missing-network-traffic-metrics-when-running-netdata-inside-a-proxmox-vm/7872/2

stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
@stelfrag stelfrag mentioned this pull request Jan 9, 2026
Ferroin pushed a commit that referenced this pull request Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Network traffic graph is not available [Bug]: PROCFILE: Cannot rewind on file '/proc/596204/net/dev

3 participants