| Summary: | Attaching to running process generates empty file | ||
|---|---|---|---|
| Product: | [Applications] Heaptrack | Reporter: | Anthony Fieroni <bvbfan> |
| Component: | general | Assignee: | Milian Wolff <mail> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | khreichel |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/sdk/heaptrack/commit/5cc1577c44b9e57840885f55a18b90dbfe3f8a59 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Anthony Fieroni
2018-05-21 14:24:25 UTC
I cannot reproduce this:
$ heaptrack -p $(pidof kwrite)
heaptrack output will be written to "/home/milian/projects/src/heaptrack/heaptrack.kwrite.15432.zst"
injecting heaptrack into application via GDB, this might take some time...
injection finished
# ctrl + o in kwrite
# then quit
heaptrack stats:
allocations: 1417920
leaked allocations: 3378
temporary allocations: 295490
removing heaptrack injection via GDB, this might take some time...
ptrace: No such process.
No symbol table is loaded. Use the "file" command.
The program is not being run.
Heaptrack finished! Now run the following to investigate the data:
heaptrack --analyze "/home/milian/projects/src/heaptrack/heaptrack.kwrite.15432.zst"
please provide more information for me on how to reproduce this. what program are you tracing? what workload do you put on it?
also, please try to run tests/auto/tst_inject on your system - does it pass?
[toni@toni-pc ~]$ uname -r 4.15.7-1 I start it like this sudo ./heaptrack -p <plasmashell pid> (ptrace wants more privileges) Plasmasheli is long-standing app, more than 11 days running, so created file is 0k, buti'm not quit plasmashell. Should i? No, you shouldn't need to quit plasma, just Ctrl + C to quick heaptrack eventually. Also, try to elevate your ptrace rights and don't use sudo: https://stackoverflow.com/questions/19215177/how-to-solve-ptrace-operation-not-permitted-when-trying-to-attach-gdb-to-a-pro echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope Now it's work. I think we should better handle this scenario though, reopening to track progress on this. @Milian If this is more or less a configuration issue of the operating system (means setting the ptrace_scope to 0 to enable Heaptrack tracing) this issue could be closed. IMHO hhere is no reasonable reason for Heaptrack to handle this case. we should at least give the user a clear indication of what's going on - i.e. forward this error message if needed (apparently that doesn't happen currently?) right - this is pretty confusing: ``` $ heaptrack -p $(pidof kontact) heaptrack output will be written to "/home/milian/projects/kdab/qitissue/build-asan/heaptrack.kontact.102573.zst" /home/milian/projects/compiled/other/lib/heaptrack/libheaptrack_preload.so injecting heaptrack into application via GDB, this might take some time... ptrace: Operation not permitted. No symbol table is loaded. Use the "file" command. No symbol table is loaded. Use the "file" command. The program is not being run. injection finished ^Cremoving heaptrack injection via GDB, this might take some time... ptrace: Operation not permitted. No symbol table is loaded. Use the "file" command. The program is not being run. Heaptrack finished! Now run the following to investigate the data: heaptrack --analyze "/home/milian/projects/kdab/qitissue/build-asan/heaptrack.kontact.102573.zst" ``` we should stop directly after the first ptrace error Git commit 5cc1577c44b9e57840885f55a18b90dbfe3f8a59 by Milian Wolff. Committed on 13/08/2021 at 09:59. Pushed by mwolff into branch 'master'. Don't try to runtime attach for /proc/sys/kernel/yama/ptrace_scope > 0 This won't work anyways, so let's error out early with a clear error message. M +4 -0 src/track/heaptrack.sh.cmake https://invent.kde.org/sdk/heaptrack/commit/5cc1577c44b9e57840885f55a18b90dbfe3f8a59 |