Comments (5)
This fixes both the simple reproducer in this report AND the bigger script that I was having trouble with originally. Thank you!
It sounds like #3195 is a workaround and not a fix, so I'll let yall close this bug report when you feel it's ready.
from bpftrace.
This looks to solve a long-standing issue I've had where data would make it into some maps but not others. This is a great find.
from bpftrace.
There's definitely a bug here, thanks for finding it!
There are a couple of different problems which I think we can separate.
Problem 1 - Overly high latencies
At first glance, I don't think this one is actually a bpftrace bug. Your script isn't handling the case where multiple openat
system calls could be happening in parallel on different threads/CPUs.
The solution is to use tid
as a key in every map access so that multiple threads don't stomp on each other's data:
tracepoint:syscalls:sys_enter_openat
{
$key = str(args->filename);
@keymap[tid] = $key;
@t[tid, $key] = elapsed;
}
(This might also fix the second problem, but that's just down to the luck of compiler optimisations)
Problem 2 - variable lifetime analysis bug
The missing value for $key
after the if
statement is a real bpftrace bug. We're not correctly calculating the lifetime of the $key
variable so the optimiser thinks it's dead too early and overwrites its memory.
Technical details for future reference: we're inserting two lifetime.end
instructions for the same variable. I think this is likely the same issue as #3000. Looking at the common patterns between the two issues, it might be using variables in map-keys that is the problem.
from bpftrace.
Confirmed this is the same issue as #3000. I've also tested your script with the fix in #3195 and the data for $key
looks good.
from bpftrace.
It sounds like #3195 is a workaround and not a fix, so I'll let yall close this bug report when you feel it's ready.
I think that fix is as good as we'll be getting in the near future - it's the same approach that we were already taking elsewhere in code generation, we'd just missed this spot. Closing.
from bpftrace.
Related Issues (20)
- some func hook invaildly, such as : kprobe:sched_setattr HOT 7
- How to get `cwd` like `comm`? HOT 3
- iter:task_file: invalid write to stack R10 off=8 size=4 HOT 2
- tests: variable.tracepoint behaves randomly on Linux v6.10 HOT 1
- tests: call.strcontains fails constantly on Linux v6.10 HOT 4
- Can't set uprobes using the appimage starting from v0.21.0 HOT 1
- `--dry-run` should not run programs
- bpftrace fails to build with bfd support on openSUSE Tumbleweed
- Unable to pass 64bit hex values larger than LLONG_MAX as positional arguments HOT 3
- Docs update suggestion for installation on Ubuntu 22.04 and lower HOT 1
- kfunc feature discovery on power
- Debug output (`-d`) in AOT HOT 1
- RFC: Probe Attributes HOT 7
- RFC: Methods HOT 2
- `strcontains` fails with stack exceeded error HOT 7
- Support an optional size parameter for `path()` builtin HOT 1
- Split output on `-lv`, to `stdout` and `stderr` HOT 2
- join(args.argv) prints nothing HOT 14
- Tracing programs must provide btf_id HOT 2
- Add AOT support for uprobe probes that use Debug Info
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bpftrace.