List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:October 15 2008 3:56pm
Subject:bzr commit into mysql-5.0-bugteam branch (kgeorge:2706) Bug#38693
View as plain text  
#At file:///home/kgeorge/mysql/bzr/B38693-5.0-bugteam/

 2706 Georgi Kodinov	2008-10-15
      Bug #38693: leaked memory with blobs!
      
      If delayed insert fails to upgrade the lock it was not
      freeing the temporary memory storage used to keep
      newly constructed blob values in memory.
      Fixed by iterating over the remaining rows in the delayed
      insert rowset and freeing the blob storage for each row.
      
      No test suite because it involves concurrent delayed inserts 
      on a table and cannot easily be made deterministic. 
      
      Added a correct valgrind suppression for Fedora 9.
modified:
  mysql-test/valgrind.supp
  sql/sql_insert.cc

per-file messages:
  mysql-test/valgrind.supp
    Added a vagrind suppression for Fedora 9
  sql/sql_insert.cc
    Bug #38693: free the blobs temp storage on error.
=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp	2007-02-08 14:57:28 +0000
+++ b/mysql-test/valgrind.supp	2008-10-15 13:55:52 +0000
@@ -319,6 +319,14 @@
    fun:_dl_map_object
 }
 
+{
+   libc pthread_exit 8
+   Memcheck:Leak
+   fun:malloc
+   fun:local_strdup
+   fun:_dl_map_object
+   fun:dl_open_worker
+}
 
 
 #

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2008-09-03 10:17:19 +0000
+++ b/sql/sql_insert.cc	2008-10-15 13:55:52 +0000
@@ -2585,6 +2585,11 @@ bool Delayed_insert::handle_inserts(void
   /* Remove all not used rows */
   while ((row=rows.get()))
   {
+    if (table->s->blob_fields)
+    {
+      memcpy(table->record[0],row->record,table->s->reclength);
+      free_delayed_insert_blobs(table);
+    }
     delete row;
     thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
     stacked_inserts--;

Thread
bzr commit into mysql-5.0-bugteam branch (kgeorge:2706) Bug#38693Georgi Kodinov15 Oct