From 230bb16003f62f0bdf7a03e40fd6a3770fb4f8d8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 30 Dec 2018 20:12:22 +0100 Subject: [PATCH] tools: improve valgrind support - Generate and use a list of suppressions that reduce noisiness for known (non-)issues. - Use `--zero-fill-buffers` for tests, as they sometimes use `Buffer.allocUnsafe()` and valgrind reports that as usage of uninitialized memory. --- tools/run-valgrind.py | 7 ++- tools/valgrind.supp | 106 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 tools/valgrind.supp diff --git a/tools/run-valgrind.py b/tools/run-valgrind.py index 67fa424584e63a..bfb67d36194190 100755 --- a/tools/run-valgrind.py +++ b/tools/run-valgrind.py @@ -37,7 +37,9 @@ VALGRIND_ARGUMENTS = [ 'valgrind', '--error-exitcode=1', - '--smc-check=all', + '--smc-check=all-non-file', + '--suppressions=' + path.join(NODE_ROOT, 'tools', 'valgrind.supp'), + '--gen-suppressions=all', ] if len(sys.argv) < 2: @@ -50,7 +52,8 @@ sys.exit(1) # Compute the command line. -command = VALGRIND_ARGUMENTS + [executable] + sys.argv[2:] +command = VALGRIND_ARGUMENTS + [executable, '--zero-fill-buffers'] +command += sys.argv[2:] # Run valgrind. process = subprocess.Popen(command, stderr=subprocess.PIPE) diff --git a/tools/valgrind.supp b/tools/valgrind.supp new file mode 100644 index 00000000000000..420c9a5171cf2a --- /dev/null +++ b/tools/valgrind.supp @@ -0,0 +1,106 @@ +{ + + Helgrind:Race + ... + fun:_ZN4node12_GLOBAL__N_1L20PlatformWorkerThreadEPv + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v88platform7tracing17TracingController31GetCategoryGroupEnabledInternalEPKc + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v86Locker8IsActiveEv + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v86Locker10InitializeEPNS_7IsolateE + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v88internal7Isolate15SetEmbeddedBlobEPKhj + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v88internal4Heap14SetStackLimitsEv + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v88internal7Isolate23CurrentEmbeddedBlobSizeEv + ... +} +{ + + Helgrind:Race + ... + fun:_ZN2v88internal7Isolate19CurrentEmbeddedBlobEv + ... +} +{ + + Memcheck:Param + epoll_ctl(event) + fun:epoll_ctl + fun:uv__io_poll + ... + obj:/home/sqrt/src/node/master/out/Release/node +} +{ + + Memcheck:Cond + ... + fun:_ZN2v88internal9ExitFrame23GetStateForFramePointerEmPNS0_10StackFrame5StateE + ... +} +{ + + Memcheck:Leak + match-leak-kinds: possible + ... + fun:pthread_create* + fun:_ZN4node9inspector12_GLOBAL__N_1L23StartDebugSignalHandlerEv + ... +} +{ + + Memcheck:Param + ioctl(generic) + fun:* + fun:uv__fs_copyfile + ... +} +{ + + Memcheck:Param + epoll_pwait(sigmask) + fun:* + fun:uv__io_poll + ... +} +{ + + Helgrind:Race + ... + fun:uv_loop_close + fun:_ZN4node18CheckedUvLoopCloseEP9uv_loop_s + fun:_ZZN4node23WorkerThreadsTaskRunner20DelayedTaskScheduler5StartEvENUlPvE_4_FUNES2_ + ... +}