Bug #25659 memory leak via "plugins" test
Submitted: 16 Jan 2007 22:38 Modified: 24 May 2007 7:27
Reporter: Chad MILLER Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: Leak, sr5_1

[16 Jan 2007 22:38] Chad MILLER
Description:
Valgrind warnings of small amount of leaked memory.

https://intranet.mysql.com/~knielsen/pb/getlog.pl?dir=mysql-5.1-new-maint&entry=msvensson@...

VALGRIND: '32 bytes in 1 blocks are still reachable in loss record 3 of 7'
    COUNT: 58
    FUNCTION: calloc    FILES:    master.err
    TESTS:    ps ps_10nestset:ps_5merge ps_7ndb ps_grant:rpl_alter_db rpl_auto_increment rpl_auto_increment_11932:rpl_commit_after_flush rpl_create_database rpl_ddl:rpl_drop_temp rpl_dual_pos_advance rpl_empty_master_crash:rpl_err_ignoredtable rpl_failed_optimize rpl_flushlog_loop rpl_foreign_key_innodb:rpl_loaddata2 rpl_loaddata_m rpl_loaddata_s:rpl_multi_update4 rpl_ndb_auto_inc:rpl_ndb_innodb_trans rpl_openssl:rpl_optimize rpl_packet rpl_ps:rpl_redirect rpl_relay_space_innodb rpl_relay_space_myisam:rpl_rewrt_db rpl_rotate_logs rpl_row_max_relay_size:rpl_slave_status rpl_sp rpl_sp004 rpl_sp_effects rpl_sporadic_master rpl_start_stop_slave:rpl_stm_flsh_tbls rpl_stm_log:rpl_temporary rpl_timezone rpl_trigger:rpl_truncate_3innodb rpl_truncate_7ndb rpl_user_variables rpl_variables rpl_view:select_safe show_check skip_grants skip_name_resolve sp-big:ssl_compress ssl_des status:strict_autoinc_3heap strict_autoinc_5ndb subselect:symlink sysdate_is_now system_mysql_db:tablelock temp_table timezone timezone2 timezone3 timezone4 timezone_grant:udf union unsafe_binlog_innodb update:view_query_cache wait_timeout warnings warnings_engine_disabled windows:xml
    STACK: at 0x4A1FB82: calloc (vg_replace_malloc.c:279)
             by 0x4C3B5EA: _dlerror_run (in /lib64/libdl-2.4.so)
             by 0x4C3B170: dlopen@@GLIBC_2.2.5 (in /lib64/libdl-2.4.so)
             by 0x7D7512: plugin_dl_add(LEX_STRING const*, int) (sql_plugin.cc:169)
             by 0x7D7EA2: plugin_add(LEX_STRING const*, LEX_STRING const*, int) (sql_plugin.cc:429)
             by 0x7D8807: plugin_load() (sql_plugin.cc:775)
             by 0x7D8D53: plugin_init(int) (sql_plugin.cc:676)
             by 0x613B1A: init_server_components() (mysqld.cc:3229)
             by 0x6167A6: main (mysqld.cc:3614)

VALGRIND: '21 bytes in 1 blocks are still reachable in loss record 2 of 7'
    COUNT: 1
    FUNCTION: malloc    FILES:    master.err
    TESTS:    warnings
    STACK: at 0x4A20859: malloc (vg_replace_malloc.c:149)
             by 0x4007C0F: _dl_map_object (in /lib64/ld-2.4.so)
             by 0x400A95C: openaux (in /lib64/ld-2.4.so)
             by 0x400C235: _dl_catch_error (in /lib64/ld-2.4.so)
             by 0x400ABE7: _dl_map_object_deps (in /lib64/ld-2.4.so)
             by 0x40100BC: dl_open_worker (in /lib64/ld-2.4.so)
             by 0x400C235: _dl_catch_error (in /lib64/ld-2.4.so)
             by 0x400FB6A: _dl_open (in /lib64/ld-2.4.so)
             by 0x4C3B1F9: dlopen_doit (in /lib64/libdl-2.4.so)
             by 0x400C235: _dl_catch_error (in /lib64/ld-2.4.so)
             by 0x4C3B58C: _dlerror_run (in /lib64/libdl-2.4.so)
             by 0x4C3B170: dlopen@@GLIBC_2.2.5 (in /lib64/libdl-2.4.so)
             by 0x7D7512: plugin_dl_add(LEX_STRING const*, int) (sql_plugin.cc:169)
             by 0x7D7EA2: plugin_add(LEX_STRING const*, LEX_STRING const*, int) (sql_plugin.cc:429)
             by 0x7D8807: plugin_load() (sql_plugin.cc:775)
             by 0x7D8D53: plugin_init(int) (sql_plugin.cc:676)

VALGRIND: '64 bytes in 1 blocks are still reachable in loss record 4 of 7'
    COUNT: 1
    FUNCTION: malloc    FILES:    master.err
    TESTS:    partition_02myisam:preload
    STACK: at 0x4A20859: malloc (vg_replace_malloc.c:149)
             by 0x40104D4: dl_open_worker (in /lib64/ld-2.4.so)
             by 0x400C235: _dl_catch_error (in /lib64/ld-2.4.so)
             by 0x400FB6A: _dl_open (in /lib64/ld-2.4.so)
             by 0x4C3B1F9: dlopen_doit (in /lib64/libdl-2.4.so)
             by 0x400C235: _dl_catch_error (in /lib64/ld-2.4.so)
             by 0x4C3B58C: _dlerror_run (in /lib64/libdl-2.4.so)
             by 0x4C3B170: dlopen@@GLIBC_2.2.5 (in /lib64/libdl-2.4.so)
             by 0x7D7512: plugin_dl_add(LEX_STRING const*, int) (sql_plugin.cc:169)
             by 0x7D7EA2: plugin_add(LEX_STRING const*, LEX_STRING const*, int) (sql_plugin.cc:429)
             by 0x7D835D: mysql_install_plugin(THD*, LEX_STRING const*, LEX_STRING const*) (sql_plugin.cc:847)
             by 0x62E806: mysql_execute_command(THD*) (sql_parse.cc:5180)
             by 0x6346B5: mysql_parse(THD*, char*, unsigned) (sql_parse.cc:6161)
             by 0x635650: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1857)
             by 0x6369EC: do_command(THD*) (sql_parse.cc:1626)
             by 0x63762C: handle_one_connection (sql_parse.cc:1232)

How to repeat:
Uncomment test name; use "--valgrind".

Suggested fix:
.
[21 May 2007 7:44] 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/commits/27057

ChangeSet@1.2520, 2007-05-21 11:48:05+05:00, svoj@mysql.com +1 -0
  BUG#25659 - memory leak via "plugins" test
  Re-enabled plugin test to check if it still leaks memory.
[21 May 2007 12: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/commits/27065

ChangeSet@1.2523, 2007-05-21 16:57:40+05:00, svoj@mysql.com +4 -0
  BUG#25659 - memory leak via "plugins" test
  
  - Added suppressions for dlopen to make plugin test pass.
  - Do not pass empty string to mysqld, since my_getopt is
    not capable to handle it.
  - Re-enabled trailing UNINSTALL PLUGIN statement of plugin.test.
[21 May 2007 14:09] 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/commits/27071

ChangeSet@1.2523, 2007-05-21 17:48:29+05:00, svoj@mysql.com +4 -0
  BUG#25659 - memory leak via "plugins" test
  
  - Added suppressions for dlopen to make plugin test pass.
  - Do not pass empty string to mysqld, since my_getopt is
    not capable to handle it.
  - Re-enabled trailing UNINSTALL PLUGIN statement of plugin.test.
  
  The memory leak described in the bug report happens in libdl, not
  in mysqld. On some valgrind installations this error is suppressed
  by default, no idea why it isn't suppressed on pb-valgrind.
  
  <observation>
  If library remains open after thread has finished, and is closed by
  another thread, we get memory leak. But in case library is opened and
  closed by the same thread no leak occurs.
  </observation>
[24 May 2007 7:05] Bugs System
Pushed into 5.1.19-beta
[24 May 2007 7:27] Sergey Vojtovich
No changelog entry needed since this fix affects test suite only.