| Summary: | Recording empty | ||
|---|---|---|---|
| Product: | [Applications] Heaptrack | Reporter: | Peter Majchrak <petoknm> |
| Component: | general | Assignee: | Milian Wolff <mail> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.5.0 | ||
| Target Milestone: | --- | ||
| Platform: | Manjaro | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
can you attach an example project that allows me to reproduce the issue? or can you reproduce it with any normal linux utility that is commonly available? yes, I can reproduce the same behaviour using `cat` and entering a few lines of text in order to hopefully trigger some allocs: ``` $ heaptrack cat heaptrack output will be written to "/home/peter/temp/heaptrack.cat.3380.zst" starting application, this might take some time... NOTE: heaptrack detected DEBUGINFOD_URLS but will disable it to prevent unintended network delays during recording If you really want to use DEBUGINFOD, export HEAPTRACK_ENABLE_DEBUGINFOD=1 hello hello whatup whatup ^Cheaptrack stats: allocations: 32 leaked allocations: 31 temporary allocations: 1 Heaptrack finished! Now run the following to investigate the data: heaptrack --analyze "/home/peter/temp/heaptrack.cat.3380.zst" heaptrack_gui detected, automatically opening the file... Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. $ ls -alh heaptrack.cat.3380.zst -rw-r--r-- 1 peter peter 0 Jan 27 17:08 heaptrack.cat.3380.zst ``` Changing back to "ASSIGNED" my `cat` rejects being called without args:
```
cat: -: input file is output file
```
if I instead use, say, `head` it works:
```
$ heaptrack head
heaptrack output will be written to "/home/milian/projects/src/heaptrack/heaptrack.head.44324.zst"
starting application, this might take some time...
NOTE: heaptrack detected DEBUGINFOD_URLS but will disable it to prevent
unintended network delays during recording
If you really want to use DEBUGINFOD, export HEAPTRACK_ENABLE_DEBUGINFOD=1
a
a
a
a
a
a
^Cheaptrack stats:
allocations: 56
leaked allocations: 50
temporary allocations: 4
Heaptrack finished! Now run the following to investigate the data:
heaptrack --analyze "/home/milian/projects/src/heaptrack/heaptrack.head.44324.zst"
$ .rw-r--r-- milian milian 1.3 KB Tue Jan 28 12:13:29 2025 /home/milian/projects/src/heaptrack/heaptrack.head.44324.zst
```
the file contains info on the 56 allocations as expected. there are no changes to `heaptrack.sh.cmake` in master since, 1.5.0 was released so I don't really know what is happening here? Can you reproduce it with `head` too?
It is possible to reproduce in a container: ``` $ docker run -it --rm manjarolinux/base bash # pacman -Sy heaptrack # heaptrack cat # ls -al -rw-r--r-- 1 root root 0 Jan 28 11:32 heaptrack.cat.663.zst ``` Currently, I'm not on the same machine, so I can only verify in the docker container, but I observe the same behaviour with `head`, i.e. the recording is empty. This seems to be a difference in how `Ctrl+C` is handled / transmitted on these shells. I can reproduce it there but quite frankly I have zero intention to try to figure it out - it seems to work just fine on my archlinux system and on an ubuntu 22.04 system too - if you feel strongly about this, please investigate what makes manjaro so special here. similarly, I'm more than willing to review patches that improve this situation, but I won't spend time myself in trying to figure such a distro specific bug out I'm afraid I see the same issue in the archlinux:base container. Let me try on ubuntu 20.04 lts as well, which is what I'm currently on. Ok, ubuntu 20.04 is too old... elfutils more specifically... I also found the same issue mentioned in the forum: https://discuss.kde.org/t/heaptrack-generating-empty-heap-dump/3156 Cannot say for sure what distro the OP used. how do you reproduce it on archlinux exactly? I run arch, with bash as my shell, and I cannot reproduce it with `head` and `cat` does not work there as I wrote earlier. ๐๐งน โ ๏ธ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME. For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging. Thank you for helping us make KDE software even better for everyone! ๐๐งน This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME. |
SUMMARY I want to record a heap profile of my webserver. This is a long running process that I start under heaptrack, but I have to stop it using Ctrl+C. When I do that, I get an empty heaptrack.*.zst file. If my program exits on its own the recording is fine. Seems like some sort of stream/pipe buffering issue to me (pipe going to zstd?). STEPS TO REPRODUCE 1. `heaptrack ./target/debug/website` 2. `ls -alh heaptrack.*` OBSERVED RESULT ``` $ heaptrack ./target/debug/website heaptrack output will be written to "/home/peter/Programming/website/heaptrack.website.40763.zst" starting application, this might take some time... NOTE: heaptrack detected DEBUGINFOD_URLS but will disable it to prevent unintended network delays during recording If you really want to use DEBUGINFOD, export HEAPTRACK_ENABLE_DEBUGINFOD=1 ^CHeaptrack finished! Now run the following to investigate the data: heaptrack --analyze "/home/peter/Programming/website/heaptrack.website.40763.zst" heaptrack_gui detected, automatically opening the file... heaptrack stats: allocations: 478 leaked allocations: 379 temporary allocations: 17 Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. $ ls -alh heaptrack.* -rw-r--r-- 1 peter peter 0 Jan 27 14:29 heaptrack.website.40763.zst ``` EXPECTED RESULT File not empty, GUI that opens to not be empty...