-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add 'get_helper_error_msg' utility #2905
Conversation
610b164
to
63c86f4
Compare
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.
Looks good! Do we know about other helpers that could use better error messages?
Good question. I'll take a look and see if anything jumps out. |
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.
nice!
Changelog entry? |
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.
Good addition! While we're adding this extra detail to this specific error message, I'm thinking that we might also want to remove unnecessary info from it too. i.e. "Failed to map_update_elem: Argument list too long"
map_update_elem is an implementation detail and "Argument list too long" doesn't mean much.
Maybe we should say something more user friendly along the lines of: "Map full, can't update element (try ...)"
src/output.cpp
Outdated
std::string msg = strerror(-retcode); | ||
if (func_id == libbpf::BPF_FUNC_map_update_elem && retcode == -E2BIG) | ||
{ | ||
msg.append(" (trying increasing MAP_KEYS_MAX)"); |
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.
msg.append(" (trying increasing MAP_KEYS_MAX)"); | |
msg.append(" (try increasing MAP_KEYS_MAX)"); |
Typo
Yeah good call. Part of me wants to leave in 'map_update_elem' for devs debugging the issue even though it's an implementation detail. The json output separates this bpf function into a field called "helper". Maybe for non-json output we can just follow the error message with a similar format e.g.
|
63c86f4
to
80dc6ef
Compare
This is for additional helpful messaging for specific errors e.g. for when the number of bpf map entries is exceeded. Follow up to: bpftrace#2809
80dc6ef
to
526e3b9
Compare
Added two more for map lookup and deletion. |
std::string msg; | ||
if (func_id == libbpf::BPF_FUNC_map_update_elem && retcode == -E2BIG) | ||
{ | ||
msg = "Map full; can't update element. Try increasing MAP_KEYS_MAX."; |
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.
This is the "old" name for w/ the config changes. Sounds like there's consensus on changing the env var names - should we preemptively use BPFTRACE_MAX_MAP_KEYS here?
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.
Depends on the merging order :) This is a smaller change so I imagine this will get merged first. Happy to change it with the config PR.
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.
I think this is good to merge. Then the other PR can rebase on top
@ajor can we merge this? |
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.
Looks good to me!
This is for additional helpful messaging for specific errors e.g. for when the number of bpf map entries is exceeded.
Follow up to: #2809
Sample output:
Checklist
man/adoc/bpftrace.adoc
and if needed indocs/reference_guide.md
CHANGELOG.md