From: Marc Alff Date: November 16 2010 8:36am Subject: bzr commit into mysql-5.5-bugteam branch (marc.alff:3122) Bug#56760 List-Archive: http://lists.mysql.com/commits/123994 X-Bug: 56760 Message-Id: <201011160837.oAFMb2np016582@acsinet15.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3628398180350992746==" --===============3628398180350992746== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///Users/malff/BZR_TREE/mysql-5.5-bugteam-56760/ based on revid:marc.alff@stripped 3122 Marc Alff 2010-11-16 Bug#56760 PFS_lock::allocated_to_free() assert failures on osx10.5-x86-64bit Before this fix, an assert could fail in PFS_lock::allocated_to_free(), during shutdown. The assert itself is valid, and detects an anomaly caused by bug 56666. While bug 56666 has no real consequences in production, the failure caused by this new assert in the code is negatively impacting the test suite with automated tests. This fix is a work around only, that relaxes the integrity checks during the server shutdown. added: storage/perfschema/unittest/stub_server_misc.h modified: sql/mysqld.cc storage/perfschema/pfs_lock.h storage/perfschema/unittest/pfs-t.cc storage/perfschema/unittest/pfs_instr-oom-t.cc storage/perfschema/unittest/pfs_instr-t.cc storage/perfschema/unittest/pfs_instr_class-oom-t.cc storage/perfschema/unittest/pfs_instr_class-t.cc === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2010-11-12 06:23:26 +0000 +++ b/sql/mysqld.cc 2010-11-16 08:36:42 +0000 @@ -324,7 +324,8 @@ static PSI_rwlock_key key_rwlock_openssl /* the default log output is log tables */ static bool lower_case_table_names_used= 0; static bool volatile select_thread_in_use, signal_thread_in_use; -static bool volatile ready_to_exit; +/* See Bug#56666 and Bug#56760 */; +volatile bool ready_to_exit; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; static my_bool opt_short_log_format= 0; static uint kill_cached_threads, wake_thread; === modified file 'storage/perfschema/pfs_lock.h' --- a/storage/perfschema/pfs_lock.h 2010-07-15 23:44:45 +0000 +++ b/storage/perfschema/pfs_lock.h 2010-11-16 08:36:42 +0000 @@ -135,7 +135,25 @@ struct pfs_lock */ void allocated_to_free(void) { - DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED); +#ifndef DBUG_OFF + extern volatile bool ready_to_exit; +#endif + + /* + If this record is not in the ALLOCATED state and the caller is trying + to free it, this is a bug: the caller is confused, + and potentially damaging data owned by another thread or object. + The correct assert to use here to guarantee data integrity is simply: + DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED); + Now, because of Bug#56666 (Race condition between the server main thread + and the kill server thread), this assert actually fails during shutdown, + and the failure is legitimate, on concurrent calls to mysql_*_destroy(), + when destroying the instrumentation of an object ... twice. + During shutdown this has no consequences for the performance schema, + so the assert is relaxed with the "|| ready_to_exit" condition as a work + around until Bug#56666 is fixed. + */ + DBUG_ASSERT((m_state == PFS_LOCK_ALLOCATED) || ready_to_exit); PFS_atomic::store_32(&m_state, PFS_LOCK_FREE); } === modified file 'storage/perfschema/unittest/pfs-t.cc' --- a/storage/perfschema/unittest/pfs-t.cc 2010-07-15 23:44:45 +0000 +++ b/storage/perfschema/unittest/pfs-t.cc 2010-11-16 08:36:42 +0000 @@ -25,6 +25,7 @@ #include #include "stub_print_error.h" +#include "stub_server_misc.h" /* test helpers, to simulate the setup */ === modified file 'storage/perfschema/unittest/pfs_instr-oom-t.cc' --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc 2010-07-15 23:44:45 +0000 +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc 2010-11-16 08:36:42 +0000 @@ -21,6 +21,7 @@ #include #include "stub_pfs_global.h" +#include "stub_server_misc.h" void test_oom() { === modified file 'storage/perfschema/unittest/pfs_instr-t.cc' --- a/storage/perfschema/unittest/pfs_instr-t.cc 2010-07-15 23:44:45 +0000 +++ b/storage/perfschema/unittest/pfs_instr-t.cc 2010-11-16 08:36:42 +0000 @@ -22,6 +22,8 @@ #include +#include "stub_server_misc.h" + void test_no_instruments() { int rc; === modified file 'storage/perfschema/unittest/pfs_instr_class-oom-t.cc' --- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc 2010-07-15 23:44:45 +0000 +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc 2010-11-16 08:36:42 +0000 @@ -20,6 +20,7 @@ #include #include "stub_pfs_global.h" +#include "stub_server_misc.h" void test_oom() { === modified file 'storage/perfschema/unittest/pfs_instr_class-t.cc' --- a/storage/perfschema/unittest/pfs_instr_class-t.cc 2010-07-15 23:44:45 +0000 +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc 2010-11-16 08:36:42 +0000 @@ -21,6 +21,8 @@ #include #include +#include "stub_server_misc.h" + void test_no_registration() { int rc; === added file 'storage/perfschema/unittest/stub_server_misc.h' --- a/storage/perfschema/unittest/stub_server_misc.h 1970-01-01 00:00:00 +0000 +++ b/storage/perfschema/unittest/stub_server_misc.h 2010-11-16 08:36:42 +0000 @@ -0,0 +1,21 @@ +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Minimal code to be able to link a unit test. +*/ + +volatile bool ready_to_exit= false; + --===============3628398180350992746== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/marc.alff@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: marc.alff@stripped # target_branch: file:///Users/malff/BZR_TREE/mysql-5.5-bugteam-56760/ # testament_sha1: 0553c2714d06349a6f98325ed65eee361732847c # timestamp: 2010-11-16 09:37:02 +0100 # base_revision_id: marc.alff@stripped\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