Bug #55387 | binlog.binlog_tmp_table crashes the server sporadically | ||
---|---|---|---|
Submitted: | 20 Jul 2010 6:44 | Modified: | 4 Aug 2010 16:42 |
Reporter: | Alexander Nozdrin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S1 (Critical) |
Version: | M3 (Celosia), M4 (Dahlia) | OS: | Any |
Assigned to: | Luis Soares | CPU Architecture: | Any |
Tags: | pb2, test failure |
[20 Jul 2010 6:44]
Alexander Nozdrin
[20 Jul 2010 15:21]
Alexander Nozdrin
It turned out that the crash is not new in trunk-bugfixing. Although the failure is reproduced now on FreeBSD only, it may affect any platform, since that code is not platform-specific.
[22 Jul 2010 9: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/114121 3133 Luis Soares 2010-07-22 BUG#55387: binlog.binlog_tmp_table crashes the server sporadically There are two problems: 1. When closing temporary tables, during the THD clean up - and after the session connection was already closed, there is a chance we can push an error into the THD diagnostics area, if the writing of the implicit DROP event to the binary log fails for some reason. As a consequence an assertion can be triggered, because at that point the diagnostics area is already set. 2. Using push_warning with MYSQL_ERROR::WARN_LEVEL_ERROR is not a recomended practice, and should not be used. Given that close_temporary_tables is mostly called from THD::cleanup - ie, with the session already closed, we fix problem #1 by allowing the diagnostics area to be overwritten. There is one other place in the code that calls close_temporary_tables - while applying Start_log_event_v3. To cover that case, we make close_temporary_tables to return the error, thus, propagating upwards in the stack. To fix problem #2, we replace push_warning with sql_print_error. @ mysql-test/suite/binlog/t/binlog_tmp_table.test Test case. @ sql/log.cc Added fault injection point while writing an event. @ sql/log_event.cc Added handling of error returned by close_temporary_tables to Start_log_event_v3::do_apply_event. @ sql/sql_base.cc Three changes to close_temporary_tables: 1. it returns an integer now (instead of void) 2. it uses sql_print_error instead of push_warning when writing to binary log fails 3. we set can_overwrite_status before writing to the binary log, thence not risking triggering an assertion by any other push into diagnostics area happening inside mysql_bin_log.write. @ sql/sql_base.h Changed the interface of close_temporary_tables so that it returns int instead of void.
[22 Jul 2010 15:26]
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/114159 3133 Luis Soares 2010-07-22 BUG#55387: binlog.binlog_tmp_table crashes the server sporadically There are two problems: 1. When closing temporary tables, during the THD clean up - and after the session connection was already closed, there is a chance we can push an error into the THD diagnostics area, if the writing of the implicit DROP event to the binary log fails for some reason. As a consequence an assertion can be triggered, because at that point the diagnostics area is already set. 2. Using push_warning with MYSQL_ERROR::WARN_LEVEL_ERROR is a bug. Given that close_temporary_tables is mostly called from THD::cleanup - ie, with the session already closed, we fix problem #1 by allowing the diagnostics area to be overwritten. There is one other place in the code that calls close_temporary_tables - while applying Start_log_event_v3. To cover that case, we make close_temporary_tables to return the error, thus, propagating upwards in the stack. To fix problem #2, we replace push_warning with sql_print_error. @ sql/log_event.cc Added handling of error returned by close_temporary_tables to Start_log_event_v3::do_apply_event. @ sql/sql_base.cc Three changes to close_temporary_tables: 1. it returns a boolean now (instead of void) 2. it uses sql_print_error instead of push_warning when writing to binary log fails 3. we set can_overwrite_status before writing to the binary log, thence not risking triggering an assertion by any other push into diagnostics area happening inside mysql_bin_log.write. @ sql/sql_base.h Changed the interface of close_temporary_tables so that it returns bool instead of void.
[22 Jul 2010 15:57]
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/114162 3133 Luis Soares 2010-07-22 BUG#55387: binlog.binlog_tmp_table crashes the server sporadically There are two problems: 1. When closing temporary tables, during the THD clean up - and after the session connection was already closed, there is a chance we can push an error into the THD diagnostics area, if the writing of the implicit DROP event to the binary log fails for some reason. As a consequence an assertion can be triggered, because at that point the diagnostics area is already set. 2. Using push_warning with MYSQL_ERROR::WARN_LEVEL_ERROR is a bug. Given that close_temporary_tables is mostly called from THD::cleanup - ie, with the session already closed, we fix problem #1 by allowing the diagnostics area to be overwritten. There is one other place in the code that calls close_temporary_tables - while applying Start_log_event_v3. To cover that case, we make close_temporary_tables to return the error, thus, propagating upwards in the stack. To fix problem #2, we replace push_warning with sql_print_error. @ sql/log_event.cc Added handling of error returned by close_temporary_tables to Start_log_event_v3::do_apply_event. @ sql/sql_base.cc Three changes to close_temporary_tables: 1. it returns a boolean now (instead of void) 2. it uses sql_print_error instead of push_warning when writing to binary log fails 3. we set can_overwrite_status before writing to the binary log, thence not risking triggering an assertion by any other push into diagnostics area happening inside mysql_bin_log.write. @ sql/sql_base.h Changed the interface of close_temporary_tables so that it returns bool instead of void.
[28 Jul 2010 11:24]
Luis Soares
Queued in mysql-trunk-bugfixing and merged to mysql-next-mr-bugfixing: - http://pb2.norway.sun.com/web.py?template=push_details&push=1444835 - http://pb2.norway.sun.com/web.py?template=push_details&push=1444831
[4 Aug 2010 7:53]
Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100731131027-1n61gseejyxsqk5d) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (merge vers: 5.1.49) (pib:18)
[4 Aug 2010 8:08]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (merge vers: 5.1.49) (pib:18)
[4 Aug 2010 8:24]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (merge vers: 5.1.49) (pib:18)
[4 Aug 2010 9:04]
Bugs System
Pushed into mysql-next-mr (revid:alik@ibmvm-20100804081630-ntapn8bf9pko9vj3) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (pib:20)
[4 Aug 2010 16:42]
Jon Stephens
Documented bugfix in the 5.5.6 changelog as follows: When closing temporary tables, after the session connection was already closed, if the writing of the implicit DROP TABLE statement into the binary log failed, it was possible for the resulting error to be mishandled, triggering an assertion. No further changelog entries required; closed.