Bug 418544 - heaptrack runs into assertion error in LineWriter.h
Summary: heaptrack runs into assertion error in LineWriter.h
Status: RESOLVED FIXED
Alias: None
Product: Heaptrack
Classification: Applications
Component: general (show other bugs)
Version: 1.1.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Milian Wolff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-06 13:24 UTC by Markus Gaisbauer
Modified: 2020-03-15 19:22 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Gaisbauer 2020-03-06 13:24:06 UTC
SUMMARY

I used heaptrack to track memory in a Java VM with a JVMTI agent.

Soon after startup I see the following assertion error:

heaptrack_interpret: /build/heaptrack-RiLtqJ/heaptrack-1.1.0+20180922.gitf752536/src/util/linewriter.h:84: bool LineWriter::write(const char*, T ...) [with T = {const char*}]: Assertion `false && "message doesn't fit into buffer"' failed.

I started heaptrack with --debug.

For some reason GDB does not stop at the assertion but milliseconds after printing the error above it stops and shows:

Thread 3 "java" received signal SIGPIPE, Broken pipe.
[Switching to Thread 0x7ffff6071700 (LWP 11824)]
__libc_write (nbytes=4066, buf=0x602340, fd=3) at ../sysdeps/unix/sysv/linux/write.c:26
26      ../sysdeps/unix/sysv/linux/write.c: No such file or directory.
(gdb) bt
#0  __libc_write (nbytes=4066, buf=0x602340, fd=3) at ../sysdeps/unix/sysv/linux/write.c:26
#1  __libc_write (fd=3, buf=0x602340, nbytes=4066) at ../sysdeps/unix/sysv/linux/write.c:24
#2  0x00007ffff7fc2746 in heaptrack_malloc () from /usr/lib/heaptrack/libheaptrack_preload.so
#3  0x00007ffff7fbfae8 in malloc () from /usr/lib/heaptrack/libheaptrack_preload.so
#4  0x00007ffff5639595 in operator new (sz=34) at ../../.././libstdc++-v3/libsupc++/new_op.cc:50
#5  0x00007ffff567638d in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate (this=this@entry=0x7ffff60706c0, __pos=3, __len1=__len1@entry=0, __s=0x7ffff00a2030 "JUMBO_ASYNC_MESSAGE_QUEUE_SIZE", __len2=30)

The resulting heaptrack file is very small and incomplete.

My agent has stripped symbols from the so and put it into a separate dbg file. When I remove the dbg file, the assertion error goes away and heaptrack file is much larger. Unfortunately without symbols for this so, the analysis is not usable for me.

We use boost internally and I know that some of our symbol names are really long (more than 1000 chars for mangled name). 

STEPS TO REPRODUCE

I can't provide a reproducer at this point.

OBSERVED RESULT

Incomplete trace.

EXPECTED RESULT

Complete trace.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 19.10
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION
Comment 1 Markus Gaisbauer 2020-03-06 13:29:51 UTC
After the first SIGPIPE, I get many many more (nbytes is always 4081), e.g.

Thread 3 "java" received signal SIGPIPE, Broken pipe.
__libc_write (nbytes=4081, buf=0x602340, fd=3) at ../sysdeps/unix/sysv/linux/write.c:26
26      in ../sysdeps/unix/sysv/linux/write.c
(gdb) bt
#0  __libc_write (nbytes=4081, buf=0x602340, fd=3) at ../sysdeps/unix/sysv/linux/write.c:26
#1  __libc_write (fd=3, buf=0x602340, nbytes=4081) at ../sysdeps/unix/sysv/linux/write.c:24
#2  0x00007ffff7fc2746 in heaptrack_malloc () from /usr/lib/heaptrack/libheaptrack_preload.so
#3  0x00007ffff7fbfae8 in malloc () from /usr/lib/heaptrack/libheaptrack_preload.so
#4  0x00007ffff5639595 in operator new (sz=32) at ../../.././libstdc++-v3/libsupc++/new_op.cc:50
Comment 2 Milian Wolff 2020-03-07 12:34:11 UTC
hmm that's bad - can you try the latest code from git? does that run into this issue too?

if yes, could you by any chance have a look into this? alternatively, can you get me an example project that I can run heaptrack on to reproduce the issue? otherwies, it's going to be super hard for me to improve the situation...
Comment 3 Markus Gaisbauer 2020-03-09 11:29:59 UTC
I compiled heaptrack sources from github master and could not reproduce the problem. Feel free to close the ticket. Hopefully Kubuntu 20.04 fill already ship with the fixed version.