FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix eBPF FD PID map iteration by stelfrag · Pull Request #22436 · netdata/netdata · GitHub

Fix eBPF FD PID map iteration - #22436

Merged
stelfrag merged 1 commit into
netdata:masterfrom
stelfrag:fix-ebpf-fd-pid-zero-lookup-log
May 7, 2026
Merged

Fix eBPF FD PID map iteration#22436
stelfrag merged 1 commit into
netdata:masterfrom
stelfrag:fix-ebpf-fd-pid-zero-lookup-log

Conversation

stelfrag commented May 7, 2026
edited by cubic-dev-ai Bot
Loading

Copy link
Copy Markdown
Collaborator
Summary

Fix the eBPF FD collector's per-PID map iteration so it consumes the key returned by bpf_map_get_next_key() before looking up the map entry.

The previous loop seeded key with 0, received the first real PID in next_key, but still attempted to look up PID 0. When PID 0 was not present in the FD map, ebpf.plugin
logged:

Failed to lookup PID 0 in FD map

once per collection cycle.

Root Cause

ebpf_read_fd_apps_table() used the stale input key after a successful bpf_map_get_next_key() call instead of the returned next_key.

Changes

  • Assign key = next_key before bpf_map_lookup_elem() in the FD apps table reader.

Summary by cubic

Fix per-PID map iteration in the eBPF FD collector by assigning key = next_key before bpf_map_lookup_elem() lookups. This eliminates incorrect PID 0 lookups and the repeated "Failed to lookup PID 0 in FD map" log.

Written for commit ee2ad7d. Summary will update on new commits.

stelfrag marked this pull request as ready for review May 7, 2026 07:37
stelfrag requested a review from thiagoftsm as a code owner May 7, 2026 07:37
Copilot AI review requested due to automatic review settings May 7, 2026 07:37
stelfrag marked this pull request as draft May 7, 2026 07:37
github-actions Bot added area/collectors Everything related to data collection collectors/ebpf labels May 7, 2026

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Fixes the eBPF FD collector’s per-PID map iteration so that the loop uses the PID returned by bpf_map_get_next_key() before attempting a bpf_map_lookup_elem(). This removes the per-cycle “Failed to lookup PID 0 in FD map” error and ensures the iteration processes the actual map entries (including the last key).

Changes:

  • Update ebpf_read_fd_apps_table() to assign key = next_key immediately after bpf_map_get_next_key().
  • Remove the stale end-of-loop key = next_key assignment that previously caused lookups against the wrong PID (notably 0 on the first iteration).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

stelfrag marked this pull request as ready for review May 7, 2026 08:15

thiagoftsm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No issues found during runtime. LGTM!

stelfrag merged commit de9a825 into netdata:master May 7, 2026
161 of 162 checks passed
stelfrag deleted the fix-ebpf-fd-pid-zero-lookup-log branch May 7, 2026 16:50
stelfrag mentioned this pull request Jun 22, 2026
Ferroin pushed a commit that referenced this pull request Jul 15, 2026
fix ebpf fd pid map iteration

(cherry picked from commit de9a825)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection collectors/ebpf

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL