Bug #27564 Valgrind: UDF does not cleanup correctly
Submitted: 31 Mar 2007 17:43 Modified: 7 Jul 2007 18:43
Reporter: Lars Thalmann Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S3 (Non-critical)
Version:5.1 Source OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any

[31 Mar 2007 17:43] Lars Thalmann
Description:
VALGRIND: 'Invalid read of size 4'
    COUNT: 1
    FUNCTION: get_hash_key    FILES:    slave.err
    TESTS:    rpl_udf
    STACK: at 0x77FD10: get_hash_key (sql_udf.cc:99)
             by 0x9C4255: hash_delete (hash.c:152)
             by 0x77FEBC: free_udf(st_udf_func*) (sql_udf.cc:294)
             by 0x589AC8: udf_handler::cleanup() (item_func.cc:2636)
             by 0x589AEF: Item_udf_func::cleanup() (item_func.cc:2934)
             by 0x6235BF: cleanup_items(Item*) (sql_parse.cc:439)
             by 0x6A4C40: Prepared_statement::cleanup_stmt() (sql_prepare.cc:2776)
             by 0x6A62C1: Prepared_statement::execute(String*, bool) (sql_prepare.cc:3055)
             by 0x6A7E76: mysql_stmt_execute(THD*, char*, unsigned) (sql_prepare.cc:2309)
             by 0x632456: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:855)
             by 0x632BCC: do_command(THD*) (sql_parse.cc:662)
             by 0x623034: handle_one_connection (sql_connect.cc:1089)
             by 0x4D44192: start_thread (in /lib64/libpthread-2.4.so)
             by 0x52B745C: clone (in /lib64/libc-2.4.so)
           Address 0x8 is not stack'd, malloc'd or (recently) free'd

How to repeat:
Enable new test case (soon to be pushed to main): rpl_udf
[21 Jun 2007 7:36] Lars Thalmann
This is not fixed.  Visible in PB:
  Date: Wed Jun 20 19:17:02 2007 lthalmann
  Tree: mysql-5.1-new-rpl

See also: BUG#28993.
[3 Jul 2007 15:14] Sergey Vojtovich
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/30172

ChangeSet@1.2660, 2007-07-03 22:14:35+05:00, svoj@mysql.com +1 -0
  BUG#27564 - Valgrind: UDF does not cleanup correctly
  
  Dropping an user defined function may cause server crash in
  case this function is still in use by another thread.
  
  The problem was that our hash implementation didn't update
  hash link list properly when hash_update() was called.
[5 Jul 2007 7:42] 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/30350

ChangeSet@1.2670, 2007-07-05 11:45:14+05:00, svoj@mysql.com +1 -0
  BUG#27564 - Valgrind: UDF does not cleanup correctly
  
  Dropping an user defined function may cause server crash in
  case this function is still in use by another thread.
  
  The problem was that our hash implementation didn't update
  hash link list properly when hash_update() was called.
[5 Jul 2007 8:45] 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/30354

ChangeSet@1.2529, 2007-07-05 12:48:11+05:00, svoj@mysql.com +1 -0
  BUG#27564 - Valgrind: UDF does not cleanup correctly
  
  Enabling rpl_udf test.
[7 Jul 2007 16:34] Bugs System
Pushed into 5.1.21-beta
[7 Jul 2007 16:35] Bugs System
Pushed into 5.0.46
[7 Jul 2007 16:37] Bugs System
Pushed into 4.1.24
[7 Jul 2007 18:43] Paul Dubois
Noted in 4.1.24, 5.0.46, 5.1.21 changelogs.

Dropping a user-defined function could cause a server crash if the
function was still in use by another thread.