Bug #41294 Object services do not clean error reporting context.
Submitted: 8 Dec 2008 11:01 Modified: 8 Apr 2009 0:25
Reporter: Rafal Somla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0-backup OS:Any
Assigned to: Jørgen Løland CPU Architecture:Any

[8 Dec 2008 11:01] Rafal Somla
Description:
Backup kernel uses the object services (si_objects) to read objects metadata and 
create objects from the metadata. This happens for example in function 
read_meta_data() called from Backup_restore_ctx::do_restore() 
(sql/backup/kernel.cc). Inside this function si_objects functions are called to 
create various types of objects.

However, the si_objects implementation does not clean the execution context 
properly which can lead to assertion failures in code used after calls to 
si_objects. To fix this problem, the following code was added in 
Backup_restore_ctx:do_restore():

  /* 
    FIXME: this call is here because object services doesn't clean the
    statement execution context properly, which leads to assertion failure.
    It should be fixed inside object services implementation and then the
    following line should be removed.
   */
  close_thread_tables(m_thd);                   // Never errors
  m_thd->main_da.reset_diagnostics_area();      // Never errors

When new si_objects implementation is in place (WL#4264) this code should be 
removed from backup kernel.

How to repeat:
Code inspection in sql/backup/kernel.cc

Suggested fix:
WL#4264 should hopefully fix this issue. Then the temporary code should be removed.
[6 Jan 2009 13:11] Jørgen Løland
The code was added because si_objects did not clean statement execution context properly. si_objects has since been completely refactored. I'm unable to reproduce any ASSERT when I remove the lines shown in the original posting. 

Rafal and I are pretty sure that the new si_objects code does not have the described problem. The patch for this bug will therefore remove the lines in kernel.cc. Should the problem ever occur again, a proper fix needs to be implemented in sql/si_objects.[cc|h], not in kernel.cc.
[6 Jan 2009 13:19] 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/62525

2746 Jorgen Loland	2009-01-06
      Bug#41294 - Object services do not clean error reporting context.
      
      Backup kernel uses the object services (si_objects) to read objects metadata and create objects from the metadata. The old si_objects did not clean the error reporting context, which could cause ASSERTS.
      
      si_objects has since been completely refactored, and the ASSERT is no longer reproducible. This patch therefore removes the cleanup code from kernel.cc. If the ASSERT is encountered later, a fix should be implemented in si_objects.[cc|h], not in kernel.cc
[6 Jan 2009 14:30] Jørgen Løland
Removed one more occurrence of the temporary fix. The ASSERT is now reproducible with the old si_objects but not with the refactored one.
[6 Jan 2009 14: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/commits/62530

2746 Jorgen Loland	2009-01-06
      Bug#41294 - Object services do not clean error reporting context.
            
      Backup kernel uses the object services (si_objects) to read objects metadata and create objects from the metadata. The old si_objects did not clean the error reporting context, which could cause ASSERTS.
            
      si_objects has since been completely refactored, and the ASSERT is no longer reproducible. This patch therefore removes the cleanup code from kernel.cc. If the ASSERT is encountered later, a fix should be implemented in si_objects.[cc|h], not in kernel.cc. Note that the ASSERT *is* reproducible if the old si_objects code is used instead of the refactored one.
[7 Jan 2009 11:03] Rafal Somla
Good to push.
[8 Jan 2009 12:56] Øystein Grøvlen
Good to push.
[26 Mar 2009 15:17] Jørgen Løland
Pushed into 6.0.11-alpha
[8 Apr 2009 0:25] Paul DuBois
Noted in 6.0.11 changelog.

Several resource leaks were corrected in the error-handling code for
the MySQL Backup library.