fix futexctn tool for symbol resolution and infinite loop#5496
Open
dubeyabhishek wants to merge 2 commits intoiovisor:masterfrom
Open
fix futexctn tool for symbol resolution and infinite loop#5496dubeyabhishek wants to merge 2 commits intoiovisor:masterfrom
dubeyabhishek wants to merge 2 commits intoiovisor:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix futexctn issues around user-space stack symbol resolution (especially for short-lived processes) and prevent an infinite loop during histogram map cleanup.
Changes:
- Updated
syms_cache__get_syms()behavior to try to refresh cached symbols on cache hits. - Changed
futexctnhistogram cleanup to snapshot keys before deleting them to avoid looping. - Added a symbol “preload” pass intended to populate the symbol cache ahead of stack printing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| libbpf-tools/trace_helpers.c | Modifies symbol cache lookup/refresh behavior in syms_cache__get_syms(). |
| libbpf-tools/futexctn.c | Adds symbol-cache preloading and changes map cleanup to delete snapshotted keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
added 2 commits
April 12, 2026 12:38
Preload symbol cache entries in the wait loop of futexctn to handle processes that exit before print_stack is invoked. Previously, syms_cache__get_syms was called lazily at print time. For short-lived processes that exit before Ctrl-C is delivered, /proc/<tgid>/maps no longer exists at print time, causing syms__load_pid to return NULL and stack traces to show "failed to get syms" or "[unknown]" for all frames. Fix this by preloading the symbol cache in wait loop throughout the collection interval. This ensures symbols are loaded while the traced process is still alive, and remain available in the cache for symbol resolution even after the process has exited. Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
Snapshot hists map keys before cleanup to bound the number of entries to delete. The cleanup loop iterated the hists map while the BPF program continued inserting new entries in parallel. Passing a deleted key back to bpf_map_get_next_key caused the kernel to return the first available key, which could be a newly inserted entry, making the loop non-terminating. Fix this by snapshotting all existing keys into a heap-allocated array before deletion. The cleanup loop then deletes only the finite set of snapshotted keys, leaving any new entries inserted by BPF during cleanup intact for the next interval. Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please find detailed description of "stack symbol resolution" and "infinite loop behavior in map cleanup" in corresponding commit message.