[erlang-questions] Errors reported by valgrind

Rickard Green <>
Fri Feb 19 19:57:33 CET 2010


There are at least two things confusing valgrind memcheck; our own
inline assembler implementations of atomics and our own memory
allocators. You want to build an emulator of TYPE "valgrind" as
described in the "How to Build a Debug Enabled Erlang RunTime System"
section of http://github.com/erlang/otp/blob/ccase/r13b04_dev/INSTALL.md
. This is how our daily valgrind tests are built. Run it as
"$ERL_TOP/bin/cerl -valgrind". In this emulator we have disabled or
replaced things that confuses valgrind memcheck.

You will probably get a bunch of warnings anyhow. Typically driver
binaries potentially lost which are false positives. Unfortunately our
valgrind suppression file isn't publicly available and cannot be used
with an unmodified valgrind. Hopefully a suppressions file that can be
used will show up in git some time in the future.

Helgrind is not possible to use since some of our own locking
mechanisms that valgrind don't know about cannot easily be replaced.
It is on our todo-list to make it possible to use helgrind, but I
cannot promise you when this will be done. We have our own
lock-checker tool that gets enabled when you debug compile the
emulator. It cannot detect all errors that helgrind can, but it
detects misuse of our internal thread interface and lock order
violations.

Regards,
Rickard Green, Erlang/OTP, Ericsson AB

2010/2/19 Martti Kuparinen <>:
> Hi,
>
> I'm using 64-bit Ubuntu 9.10 and I downloaded R13B03 and compiled it with
>
>
> CFLAGS="-g" LDFLAGS="-g" ./configure --prefix=/tmp/otp13b3 --enable-threads
> --enable-smp-support --enable-kernel-poll --enable-hipe
> --enable-megaco-flex-scanner-lineno --enable-megaco-reentrant-flex-scanner
> --enable-dynamic-ssl-lib--enable-shared-zlib
> make
>
>
> Next I wanted to see what valgrind 3.5.0 thinks so I executed
>
>
> cd bin/x86_64-unknown-linux-gnu
> export BINDIR=`pwd`
>
> valgrind --trace-children=yes --verbose --leak-check=full \
>         --show-reachable=yes --track-origins=yes --malloc-fill=AB \
>         --free-fill=CD \
>         ./erlexec
> q().
>
> ==24653== LEAK SUMMARY:
> ==24653==    definitely lost: 57,344 bytes in 7 blocks
> ==24653==    indirectly lost: 0 bytes in 0 blocks
> ==24653==      possibly lost: 2,108,608 bytes in 15 blocks
> ==24653==    still reachable: 9,001,366 bytes in 89 blocks
> ==24653==         suppressed: 0 bytes in 0 blocks
> ==24653==
> ==24653== ERROR SUMMARY: 9 errors from 9 contexts (suppressed: 4 from 4)
>
>
> I also executed
>
>
> valgrind --trace-children=yes --verbose --tool=helgrind \
>         ./erlexec
> q().
>
> ==24733== ERROR SUMMARY: 754 errors from 97 contexts (suppressed: 13211 from
> 190)
>
>
> Most of those were "Possible data race during write of size X" and "Thread
> #X: lock order ... violated" kind of errors.
>
> Anyone else getting similar results? Should I file a problem report (where?)
> or is this mail enough?
>
> Martti
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list