Skip to content

Commit ddf6883

Browse files
authored
Merge pull request #133 from polycube-network/pr/documentation_valgrind
docs: add instructions to run valgrind
2 parents cc4cf71 + f86a2af commit ddf6883

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Documentation/developers/hints.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,43 @@ What to do when *testing failing* ?
123123
***********************************
124124

125125
Click in testing failing button, go to jenkins control panel, open the build number is failing, open console output in order to understand where tests are failing. At the end of the output there is a summary with tests passing/failing.
126+
127+
128+
Valgrind
129+
^^^^^^^^
130+
131+
Valgrind is an open source tool for analyzing memory management and threading bugs. It can easily discover memory leaks, and spot possible segfault errors.
132+
133+
134+
Requirements for polycubed: (1) valgrind 3.15+ (2) disable `setrlimit` in polycubed.cpp
135+
136+
1 Install valgrind 3.15
137+
***********************
138+
139+
Valgrind 3.14+ is introducing support for bpf() system call.
140+
Previous versions won't work.
141+
142+
- Download Valgrind 3.15+ source from here http://www.valgrind.org/downloads/current.html
143+
- Build Valgrind from source http://valgrind.org/docs/manual/dist.install.html
144+
::
145+
146+
./configure
147+
make
148+
sudo make install
149+
150+
2 Disable `setrlimit`
151+
*********************
152+
153+
Only for debug purposes and in order to be able to run valgrind we have to disable `setrlimit` in polycubed.cpp.
154+
155+
We suggest to comment out following lines in :scm_web:`polycubed.cpp <src/polycubed/src/polycubed.cpp#L226>`
156+
::
157+
158+
// Each instance of a service requires a high number of file descriptors
159+
// (for example helloworld required 7), hence the default limit is too low
160+
// for creating many instances of the services.
161+
struct rlimit r = {32 * 1024, 64 * 1024};
162+
if (setrlimit(RLIMIT_NOFILE, &r)) {
163+
logger->critical("Failed to set max number of possible filedescriptor");
164+
return -1;
165+
}

0 commit comments

Comments
 (0)