Skip to content

Commit 1cbadd8

Browse files
committed
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. PR-URL: #25498 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 92dd899 commit 1cbadd8

File tree

2 files changed

+111
-2
lines changed

2 files changed

+111
-2
lines changed

tools/run-valgrind.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
VALGRIND_ARGUMENTS = [
3838
'valgrind',
3939
'--error-exitcode=1',
40-
'--smc-check=all',
40+
'--smc-check=all-non-file',
41+
'--suppressions=' + path.join(NODE_ROOT, 'tools', 'valgrind.supp'),
42+
'--gen-suppressions=all',
4143
]
4244

4345
if len(sys.argv) < 2:
@@ -50,7 +52,8 @@
5052
sys.exit(1)
5153

5254
# Compute the command line.
53-
command = VALGRIND_ARGUMENTS + [executable] + sys.argv[2:]
55+
command = VALGRIND_ARGUMENTS + [executable, '--zero-fill-buffers']
56+
command += sys.argv[2:]
5457

5558
# Run valgrind.
5659
process = subprocess.Popen(command, stderr=subprocess.PIPE)

tools/valgrind.supp

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
<PW_trace_event>
3+
Helgrind:Race
4+
...
5+
fun:_ZN4node12_GLOBAL__N_1L20PlatformWorkerThreadEPv
6+
...
7+
}
8+
{
9+
<tracing_group>
10+
Helgrind:Race
11+
...
12+
fun:_ZN2v88platform7tracing17TracingController31GetCategoryGroupEnabledInternalEPKc
13+
...
14+
}
15+
{
16+
<locker_is_active>
17+
Helgrind:Race
18+
...
19+
fun:_ZN2v86Locker8IsActiveEv
20+
...
21+
}
22+
{
23+
<locker_initialize>
24+
Helgrind:Race
25+
...
26+
fun:_ZN2v86Locker10InitializeEPNS_7IsolateE
27+
...
28+
}
29+
{
30+
<set_embedded_blob>
31+
Helgrind:Race
32+
...
33+
fun:_ZN2v88internal7Isolate15SetEmbeddedBlobEPKhj
34+
...
35+
}
36+
{
37+
<set_stack_limits>
38+
Helgrind:Race
39+
...
40+
fun:_ZN2v88internal4Heap14SetStackLimitsEv
41+
...
42+
}
43+
{
44+
<current_embedded_blob_size>
45+
Helgrind:Race
46+
...
47+
fun:_ZN2v88internal7Isolate23CurrentEmbeddedBlobSizeEv
48+
...
49+
}
50+
{
51+
<current_embedded_blob>
52+
Helgrind:Race
53+
...
54+
fun:_ZN2v88internal7Isolate19CurrentEmbeddedBlobEv
55+
...
56+
}
57+
{
58+
<epoll_invalid_param>
59+
Memcheck:Param
60+
epoll_ctl(event)
61+
fun:epoll_ctl
62+
fun:uv__io_poll
63+
...
64+
obj:/home/sqrt/src/node/master/out/Release/node
65+
}
66+
{
67+
<frame_ptr_ne>
68+
Memcheck:Cond
69+
...
70+
fun:_ZN2v88internal9ExitFrame23GetStateForFramePointerEmPNS0_10StackFrame5StateE
71+
...
72+
}
73+
{
74+
<debug_signal_thread_stack_storage>
75+
Memcheck:Leak
76+
match-leak-kinds: possible
77+
...
78+
fun:pthread_create*
79+
fun:_ZN4node9inspector12_GLOBAL__N_1L23StartDebugSignalHandlerEv
80+
...
81+
}
82+
{
83+
<copyfile_ioctl>
84+
Memcheck:Param
85+
ioctl(generic)
86+
fun:*
87+
fun:uv__fs_copyfile
88+
...
89+
}
90+
{
91+
<epoll_pwait>
92+
Memcheck:Param
93+
epoll_pwait(sigmask)
94+
fun:*
95+
fun:uv__io_poll
96+
...
97+
}
98+
{
99+
<platform_worker_threads_uv_loop_close_after_async_send>
100+
Helgrind:Race
101+
...
102+
fun:uv_loop_close
103+
fun:_ZN4node18CheckedUvLoopCloseEP9uv_loop_s
104+
fun:_ZZN4node23WorkerThreadsTaskRunner20DelayedTaskScheduler5StartEvENUlPvE_4_FUNES2_
105+
...
106+
}

0 commit comments

Comments
 (0)