Bug #41356 Valgrind warnings from falcon code during database creation
Submitted: 10 Dec 2008 12:51 Modified: 26 May 2010 17:46
Reporter: Vemund Østgaard Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.9 OS:Linux (64-bit)
Assigned to: Vladislav Vaintroub CPU Architecture:Any
Tags: F_TEST
Triage: Triaged: D2 (Serious)

[10 Dec 2008 12:51] Vemund Østgaard
Description:
I ran the large_tests suite with MTR under Valgrind, and saw two warnings at the start of the test during Falcon database creation:

CURRENT_TEST: large_tests.alter_table
==21781== Memcheck, a memory error detector.
==21781== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==21781== Using LibVEX rev 1854, a library for dynamic binary translation.
==21781== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==21781== Using valgrind-3.3.1, a dynamic binary instrumentation framework.
==21781== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==21781== For more details, rerun with: -v
==21781==
081209 19:41:28 [Note] Plugin 'InnoDB' disabled by command line option
081209 19:41:29 [Note] Falcon: unable to open system data files.
081209 19:41:29 [Note] Falcon: creating new system data files.
==21781== Mismatched free() / delete / delete []
==21781==    at 0x4905FEC: operator delete(void*) (vg_replace_malloc.c:342)
==21781==    by 0x938F9A: StringTransform::~StringTransform() (StringTransform.cpp:42)
==21781==    by 0x932CDD: DecodeTransform<StringTransform, Base64Transform>::~DecodeTransform() (User.cpp:106)
==21781==    by 0x932A01: User::changePassword(char const*) (User.cpp:107)
==21781==    by 0x932313: User::User(Database*, char const*, char const*, Coterie*, bool) (User.cpp:53)
==21781==    by 0x8EBBF7: RoleModel::RoleModel(Database*) (MemoryManager.h:56)
==21781==    by 0x88F7F5: Database::start() (MemoryManager.h:56)
==21781==    by 0x891AA0: Database::createDatabase(char const*) (Database.cpp:641)
==21781==    by 0x889942: Connection::createDatabase(char const*, char const*, char const*, char const*, Threads*) (Connection.cpp:1064)
==21781==    by 0x84297B: StorageDatabase::createDatabase() (StorageDatabase.cpp:162)
==21781==    by 0x8492D3: StorageHandler::createDatabase() (StorageHandler.cpp:1025)
==21781==    by 0x849155: StorageHandler::initialize() (StorageHandler.cpp:1003)
==21781==    by 0x839271: StorageInterface::falcon_init(void*) (ha_falcon.cpp:240)
==21781==    by 0x738575: ha_initialize_handlerton(st_plugin_int*) (handler.cc:440)
==21781==    by 0x7CC60D: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1006)
==21781==    by 0x7CCBA3: plugin_init(int*, char**, int) (sql_plugin.cc:1213)
==21781==  Address 0x61381f0 is 0 bytes after a block of size 0 alloc'd
==21781==    at 0x490584B: operator new[](unsigned long) (vg_replace_malloc.c:274)
==21781==    by 0x939246: StringTransform::setString(unsigned long, unsigned char const*, bool) (StringTransform.cpp:64)
==21781==    by 0x9390D9: StringTransform::StringTransform(char const*, bool) (StringTransform.cpp:48)
==21781==    by 0x932D89: DecodeTransform<StringTransform, Base64Transform>::DecodeTransform(char const*) (DecodeTransform.h:63)
==21781==    by 0x9329AA: User::changePassword(char const*) (User.cpp:106)
==21781==    by 0x932313: User::User(Database*, char const*, char const*, Coterie*, bool) (User.cpp:53)
==21781==    by 0x8EBBF7: RoleModel::RoleModel(Database*) (MemoryManager.h:56)
==21781==    by 0x88F7F5: Database::start() (MemoryManager.h:56)
==21781==    by 0x891AA0: Database::createDatabase(char const*) (Database.cpp:641)
==21781==    by 0x889942: Connection::createDatabase(char const*, char const*, char const*, char const*, Threads*) (Connection.cpp:1064)
==21781==    by 0x84297B: StorageDatabase::createDatabase() (StorageDatabase.cpp:162)
==21781==    by 0x8492D3: StorageHandler::createDatabase() (StorageHandler.cpp:1025)
==21781==    by 0x849155: StorageHandler::initialize() (StorageHandler.cpp:1003)
==21781==    by 0x839271: StorageInterface::falcon_init(void*) (ha_falcon.cpp:240)
==21781==    by 0x738575: ha_initialize_handlerton(st_plugin_int*) (handler.cc:440)
==21781==    by 0x7CC60D: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1006)
==21781==
==21781== Mismatched free() / delete / delete []
==21781==    at 0x4905FEC: operator delete(void*) (vg_replace_malloc.c:342)
==21781==    by 0x938F9A: StringTransform::~StringTransform() (StringTransform.cpp:42)
==21781==    by 0x88BC7E: EncryptTransform<StringTransform, SHATransform, Base64Transform>::~EncryptTransform() (Connection.cpp:212)
==21781==    by 0x932C26: User::encryptPassword(char const*) (User.cpp:150)
==21781==    by 0x8EC1E9: RoleModel::createUser(char const*, char const*, bool, Coterie*) (RoleModel.cpp:176)
==21781==    by 0x894F73: Database::createUser(char const*, char const*, bool, Coterie*) (Database.cpp:1658)
==21781==    by 0x8899F3: Connection::createDatabase(char const*, char const*, char const*, char const*, Threads*) (Connection.cpp:1075)
==21781==    by 0x84297B: StorageDatabase::createDatabase() (StorageDatabase.cpp:162)
==21781==    by 0x8492D3: StorageHandler::createDatabase() (StorageHandler.cpp:1025)
==21781==    by 0x849155: StorageHandler::initialize() (StorageHandler.cpp:1003)
==21781==    by 0x839271: StorageInterface::falcon_init(void*) (ha_falcon.cpp:240)
==21781==    by 0x738575: ha_initialize_handlerton(st_plugin_int*) (handler.cc:440)
==21781==    by 0x7CC60D: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1006)
==21781==    by 0x7CCBA3: plugin_init(int*, char**, int) (sql_plugin.cc:1213)
==21781==    by 0x641559: init_server_components() (mysqld.cc:4093)
==21781==    by 0x641CDA: main (mysqld.cc:4562)
==21781==  Address 0x6138d90 is 0 bytes inside a block of size 5 alloc'd
==21781==    at 0x490584B: operator new[](unsigned long) (vg_replace_malloc.c:274)
==21781==    by 0x939246: StringTransform::setString(unsigned long, unsigned char const*, bool) (StringTransform.cpp:64)
==21781==    by 0x9390D9: StringTransform::StringTransform(char const*, bool) (StringTransform.cpp:48)
==21781==    by 0x88BD86: EncryptTransform<StringTransform, SHATransform, Base64Transform>::EncryptTransform(char const*, int) (EncryptTransform.h:37)
==21781==    by 0x932C07: User::encryptPassword(char const*) (User.cpp:148)
==21781==    by 0x8EC1E9: RoleModel::createUser(char const*, char const*, bool, Coterie*) (RoleModel.cpp:176)
==21781==    by 0x894F73: Database::createUser(char const*, char const*, bool, Coterie*) (Database.cpp:1658)
==21781==    by 0x8899F3: Connection::createDatabase(char const*, char const*, char const*, char const*, Threads*) (Connection.cpp:1075)
==21781==    by 0x84297B: StorageDatabase::createDatabase() (StorageDatabase.cpp:162)
==21781==    by 0x8492D3: StorageHandler::createDatabase() (StorageHandler.cpp:1025)
==21781==    by 0x849155: StorageHandler::initialize() (StorageHandler.cpp:1003)
==21781==    by 0x839271: StorageInterface::falcon_init(void*) (ha_falcon.cpp:240)
==21781==    by 0x738575: ha_initialize_handlerton(st_plugin_int*) (handler.cc:440)
==21781==    by 0x7CC60D: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1006)
==21781==    by 0x7CCBA3: plugin_init(int*, char**, int) (sql_plugin.cc:1213)
==21781==    by 0x641559: init_server_components() (mysqld.cc:4093)
081209 19:41:33 [Warning] /home/vo136787/mysql/mysql-6.0/libexec/mysqld: unknown option '--loose-skip-ndbcluster'
081209 19:41:34 [Note] Event Scheduler: Loaded 0 events
081209 19:41:34 [Note] /home/vo136787/mysql/mysql-6.0/libexec/mysqld: ready for connections.
Version: '6.0.9-alpha-debug-log'  socket: '/export/home/tmp/vardir/tmp/master.sock'  port: 123456  Source distribution

The binaries were built from my personal branch updated from the mysql-6.0 tree on Dec 12:

vo136787@khepri16:~/bazaar/mysql-6.0> bzr log --short --show-ids -r-1
 2774 Alexander Nozdrin 2008-12-08 [merge]
      revision-id:alik@sun.com-20081208125410-cb4f3myd4n1cf2r9
      Merge from 6.0

 $ ./configure --prefix=/home/vo136787/mysql/mysql-6.0 --disable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-plugin-maria --with-maria-tmp-tables --with-readline --with-debug --with-ssl --with-plugins=max-no-ndb --with-embedded-server --enable-local-infile

How to repeat:
Seen once when running the large_tests suite under Valgrind, I have not tried to reproduce it.
[15 Dec 2008 17:23] Vladislav Vaintroub
Pushed (unfortunately with the wrong Bugnumber) under
http://lists.mysql.com/commits/61215

 2930 Vladislav Vaintroub	2008-12-10
       Bug#41357  - Valgrind warnings from falcon code during database creation
      
      Problem : memory allocated during StringTransform constructor with new[] was freed
with delete(void *) in destructore, instead of  delete[] (void *).
      Fix: use correct delete operator.
modified:
  storage/falcon/TransformLib/StringTransform.cpp