maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #00439
Updated (by Guest): Using the Valgrind API in mysqld (23)
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Using the Valgrind API in mysqld
CREATION DATE..: Fri, 22 May 2009, 11:43
SUPERVISOR.....: Psergey
IMPLEMENTOR....: Knielsen
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 23 (http://askmonty.org/worklog/?tid=23)
VERSION........: Server-9.x
STATUS.........: Complete
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 40 (hours remain)
ORIG. ESTIMATE.: 40
PROGRESS NOTES:
-=-=(Guest - Sat, 20 Jun 2009, 21:35)=-=-
Version updated.
--- /tmp/wklog.23.old.7421 2009-06-20 21:35:40.000000000 +0300
+++ /tmp/wklog.23.new.7421 2009-06-20 21:35:40.000000000 +0300
@@ -1 +1 @@
-Connector/J-3.2
+Server-9.x
-=-=(Guest - Fri, 19 Jun 2009, 20:48)=-=-
Version updated.
--- /tmp/wklog.23.old.1520 2009-06-19 20:48:56.000000000 +0300
+++ /tmp/wklog.23.new.1520 2009-06-19 20:48:56.000000000 +0300
@@ -1 +1 @@
-GUI-Tools-3.0
+Connector/J-3.2
-=-=(Guest - Fri, 19 Jun 2009, 20:45)=-=-
Version updated.
--- /tmp/wklog.23.old.1480 2009-06-19 20:45:53.000000000 +0300
+++ /tmp/wklog.23.new.1480 2009-06-19 20:45:53.000000000 +0300
@@ -1 +1 @@
-Connector/.NET-2.0
+GUI-Tools-3.0
-=-=(Guest - Fri, 19 Jun 2009, 20:42)=-=-
Version updated.
--- /tmp/wklog.23.old.1373 2009-06-19 20:42:48.000000000 +0300
+++ /tmp/wklog.23.new.1373 2009-06-19 20:42:48.000000000 +0300
@@ -1 +1 @@
-WorkLog-3.4
+Connector/.NET-2.0
-=-=(Guest - Fri, 19 Jun 2009, 20:39)=-=-
Version updated.
--- /tmp/wklog.23.old.1347 2009-06-19 20:39:44.000000000 +0300
+++ /tmp/wklog.23.new.1347 2009-06-19 20:39:44.000000000 +0300
@@ -1 +1 @@
-Server-6.0
+WorkLog-3.4
-=-=(Guest - Fri, 19 Jun 2009, 20:36)=-=-
Version updated.
--- /tmp/wklog.23.old.1240 2009-06-19 20:36:40.000000000 +0300
+++ /tmp/wklog.23.new.1240 2009-06-19 20:36:40.000000000 +0300
@@ -1 +1 @@
-Connector/J-5.2
+Server-6.0
-=-=(Guest - Fri, 19 Jun 2009, 20:33)=-=-
Version updated.
--- /tmp/wklog.23.old.1136 2009-06-19 20:33:36.000000000 +0300
+++ /tmp/wklog.23.new.1136 2009-06-19 20:33:36.000000000 +0300
@@ -1 +1 @@
-Server-5.1
+Connector/J-5.2
-=-=(Guest - Fri, 19 Jun 2009, 20:30)=-=-
Version updated.
--- /tmp/wklog.23.old.1109 2009-06-19 20:30:32.000000000 +0300
+++ /tmp/wklog.23.new.1109 2009-06-19 20:30:32.000000000 +0300
@@ -1 +1 @@
-Maria-1.0
+Server-5.1
-=-=(Guest - Fri, 19 Jun 2009, 20:27)=-=-
Version updated.
--- /tmp/wklog.23.old.1004 2009-06-19 20:27:28.000000000 +0300
+++ /tmp/wklog.23.new.1004 2009-06-19 20:27:28.000000000 +0300
@@ -1 +1 @@
-Connector/J-3.1
+Maria-1.0
-=-=(Guest - Fri, 19 Jun 2009, 20:24)=-=-
Version updated.
--- /tmp/wklog.23.old.907 2009-06-19 20:24:24.000000000 +0300
+++ /tmp/wklog.23.new.907 2009-06-19 20:24:24.000000000 +0300
@@ -1 +1 @@
-Maria-1.1
+Connector/J-3.1
------------------------------------------------------------
-=-=(View All Progress Notes, 173 total)=-=-
http://askmonty.org/worklog/index.pl?tid=23&nolimit=1
DESCRIPTION:
Valgrind (the memcheck tool) has some very useful APIs that can be used in mysqld
when testing with Valgrind to improve testing and/or debugging:
file:///usr/share/doc/valgrind/html/mc-manual.html#mc-manual.clientreqs
file:///usr/share/doc/valgrind/html/mc-manual.html#mc-manual.mempools
This worklog is about adding configure checks and headers to allow to use these
in a way that continues to work on machines where the Valgrind headers or
functionality is missing.
It also includes adding some basic Valgrind enhancements:
- Adding Valgrind annotations to custom memory allocators so that Valgrind can
detect leaks, use-before-init, and use-after-free problems also for these
allocators.
- Adding checks for definedness in appropriate places (eg. when calling libz).
HIGH-LEVEL SPECIFICATION:
With custom memory allocators, using the Valgrind APIs we can tell Valgrind when
a memory block is allocated (so that data read from memory is marked as undefined
instead of being defined or not at random depending on prior use); and when a
memory block is freed (so that use after freeing can be reported as an error).
In some cases cheking for leaks may also be appropriate.
Another possibility is to add an explicit check for whether memory is defined.
One place this would be useful is when calling libz. Due to the design of that
library, Valgrind produces lots of false alarms about using undefined values
(I think the issue is that it runs a few bytes off of initialized memory to
reduce boundary checks in each loop iteration, then after the loop has checks to
avoid using the undefined part of the result). This means we have lots of libz
Valgrind suppressions and continue to add more as new warnings surface. So we
might easily miss a real problem in this area. This could be improved by adding
explicit checks at the call to libz functions that the passed memory is properly
defined.
Another use is to improve debugging. It is often the case when debugging a
warning about using un-initialised memory that the detection happens long after
the real problem, the un-initialized value being passed along through the code
for a long time before being detected. This makes debugging the problem slow.
By adding in strategic places code that asserts that a specific value must be
initialised, it is possible to detect problems earlier, speeding up debugging.
Such code can be added in more places over time as development and debugging
goes on.
See also a patch here: http://bugs.mysql.com/bug.php?id=44582
LOW-LEVEL DESIGN:
Two places where we call into libz, and where checking for defined parameters
would be good:
- mysys/my_compress.c
- sql/item_strfunc.cc (Item_func_compress).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)