Bug #9626 Several serious errors reported by Valgrind in latest 5.0 bk tree
Submitted: 4 Apr 2005 20:59 Modified: 7 Jun 2005 8:50
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0-bk OS:Linux (linux)
Assigned to: Magnus Blåudd CPU Architecture:Any

[4 Apr 2005 20:59] Guilhem Bichot
Description:
You need Valgrind *2.4.0* to test this; 2.2.0 segfaults and hangs at various tests. Then pull 5.0 and:
BUILD/compile-pentium-valgrind-max
./mysql-test-run --valgrind --force
Most warnings are about unfreed memory allocated by pthread_create(), but there are really serious ones, drowned in the middle of the Valgrind log:

==18453==    at 0x8502AF7: heap_create (hp_create.c:171)
<cut>
==10212==    at 0x818A0B7: Item_char_typecast::val_str(String*) (sql_string.h:91)
<cut>
==10212==    at 0x853A5B5: my_vsnprintf (my_vsnprintf.c:91)
<any other ones to look at>

In the "Files" section of this bug report I attach the var/log/master.err (slave.err has only pthread_create() warnings). To help find the "non-pthread_create" warnings out of it, do this grep:
   for i in "^Warning:" "^Error:" "^==.* at 0x"
    do
      grep -n "$i" var/log/master.err | grep -v calloc > filt_warnings
   done
filt_warnings will contain the serious warnings with a line number for you to get back to the total error message in var/log/master.err.

How to repeat:
See description.
[6 Apr 2005 9:47] Martin Skold
The following warnings is due to the thread for query cache maintenance
in ndbcluster not being exited properly at server shutdown (this is not
a show stopper leak, but will be looked at ASAP). 
==18453== 39012 (656 direct, 38356 indirect) bytes in 1 blocks are definitely lo
<monty> st in loss record 9 of 12
<monty> ==18453==    at 0x1B9042A4: malloc (vg_replace_malloc.c:130)
<monty> ==18453==    by 0x84AC6CE: NdbMem_Allocate (NdbMem.c:39)
<monty> ==18453==    by 0x84B91D3: operator new(unsigned) (new.cpp:13)
<monty> ==18453==    by 0x8464C23: Ndb::setup(Ndb_cluster_connection*, char const*, char
<monty>  const*) (Ndbinit.cpp:53)
<monty> ==18453==    by 0x8464B6F: Ndb::Ndb(Ndb_cluster_connection*, char const*, char c
<monty> onst*) (Ndbinit.cpp:43)
<monty> ==18453==    by 0x82B167D: ndb_util_thread_func (ha_ndbcluster.cc:5796)
<monty> ==18453==    by 0x4274898B: start_thread (in /lib/tls/libpthread-0.61.so)
<monty> and in some other test (not sure which):
<monty> ==18589== 612 bytes in 9 blocks are possibly lost in loss record 6 of 8
<monty> ==18589==    at 0x1B904BD5: calloc (vg_replace_malloc.c:175)
<monty> ==18589==    by 0x1B8F269C: _dl_allocate_tls (in /lib/ld-2.3.3.so)
<monty> ==18589==    by 0x42749746: allocate_stack (in /lib/tls/libpthread-0.61.so)
<monty> ==18589==    by 0x42748BB7: pthread_create@@GLIBC_2.1 (in /lib/tls/libpthread-0.
<monty> 61.so)
<monty> ==18589==    by 0x84AC4E7: NdbThread_Create (NdbThread.c:104)
<monty> ==18589==    by 0x84BBB20: TransporterFacade::init(unsigned, ndb_mgm_configurati
<monty> on const*) (TransporterFacade.cpp:544)
<monty> ==18589==    by 0x84BB31D: TransporterFacade::start_instance(int, ndb_mgm_config
<monty> uration const*) (TransporterFacade.cpp:345)
<monty> ==18589==    by 0x848B9F4: Ndb_cluster_connection::connect(int, int, int) (ndb_c
<monty> luster_connection.cpp:496)
<monty> ==18589==    by 0x82AE911: ndbcluster_init() (ha_ndbcluster.cc:4619)
<monty> ==18589==    by 0x8285CC5: ha_init() (handler.cc:397)
<monty> ==18589==    by 0x81CA3F2: init_server_components() (mysqld.cc:2790)
<monty> ==18589==    by 0x81CA944: main (mysqld.cc:3095)
[6 Apr 2005 10:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/23705
[7 Apr 2005 11:09] Michael Widenius
Have now fixed all warnings, except
- Errors reported by pthread_create (added local suppress file to get rid of these)
- Errors reported by libz (added local suppress file to get rid of these)
- Errors in ndb tests (the ndb team is working on these)
- Not freed memory in InnoDB (Created a new bug report for this, #9673)
- The warning from rr_cmp() as this was ok. (Will soon push a fix where this doesn't show up when compiling for valgrind)

The above is pushed into 5.0.4 tree
[13 May 2005 11:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24857
[30 May 2005 14:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25066
[2 Jun 2005 12:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25511
[2 Jun 2005 12:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25512
[7 Jun 2005 8:50] Magnus Blåudd
Pushed fixes to mysql-5.0-ndb. Wrote three new more specific bug reports for remaining valgrind warnings.