Bug #51612 Un initialized locker_lost variable in pfs_instr.cc
Submitted: 1 Mar 2010 16:22 Modified: 6 Mar 2010 19:37
Reporter: Marc ALFF Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:mysql-next-mr, 5.5.99-m3 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[1 Mar 2010 16:22] Marc ALFF
Description:
There is an un-explained difference between 5.5 and 6.0,
in storage/perfschema/pfs_instr.cc

In 5.5:
ulong locker_lost;

In 6.0:
ulong locker_lost= 0;

The correct code is to initialize this variable to 0.

5.5 could possibly fail with unpredictable results for the locker_lost
counter, in show status. There are no other side effects.

Probably caused by bad merges when back porting the performance schema patch from 6.0 to 5.5.

How to repeat:
Read the code.

Suggested fix:
malff@linux-su11:perfschema> bzr diff
=== modified file 'storage/perfschema/pfs_instr.cc'
--- storage/perfschema/pfs_instr.cc     2010-02-26 17:39:57 +0000
+++ storage/perfschema/pfs_instr.cc     2010-03-01 16:14:04 +0000
@@ -66,7 +66,7 @@
 /** Number of instruments class per thread. */
 ulong instr_class_per_thread;
 /** Number of locker lost. @sa LOCKER_STACK_SIZE. */
-ulong locker_lost;
+ulong locker_lost= 0;

 /**
   Mutex instrumentation instances array.
[1 Mar 2010 16:39] Dmitry Lenev
Approved. Just mention in the ChangeSet comment that is mostly issue of code differences between 5.5 and 6.0. And there is no practical difference since AFAIU
global variables are initialized to 0 by default.
[2 Mar 2010 0:13] 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/101983

3120 Marc Alff	2010-03-01
      Bug#51612 Un initialized locker_lost variable in pfs_instr.cc
      
      Fixed the missing initialization of locker_lost.
      
      This fix is not strictly necessary, but is desirable to re-align the code
      from 5.5 and 6.0, and reduce the spurious code differences.
      
      This will facilitate maintenance and help to apply patches cleanly, for merges.
[2 Mar 2010 0:23] Marc ALFF
Patch queued in:
- mysql-next-mr-bugfixing
- mysql-6.0-codebase-bugfixing

Doc team:
- minor code cleanup, no visible change to document.
[6 Mar 2010 10:29] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100306102742-yw9zzgw9ac5r65m5) (version source revid:bar@mysql.com-20100305074327-h09o5lw290s04lcf) (merge vers: 6.0.14-alpha) (pib:16)
[6 Mar 2010 10:31] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100306102638-qna09hbjb5gm940h) (version source revid:alik@sun.com-20100304153932-9hajxhhyanqbckmu) (pib:16)
[6 Mar 2010 10:56] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:alik@sun.com-20100304153932-9hajxhhyanqbckmu) (merge vers: 5.5.99-m3) (pib:16)
[6 Mar 2010 19:37] Paul DuBois
No user-visible effects. No changelog entry needed.