Bug #89421 Missing mutex_unlock in Slave_reporting_capability::va_report
Submitted: 25 Jan 2018 16:42 Modified: 20 Jun 2018 11:11
Reporter: Zsolt Parragi (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[25 Jan 2018 16:42] Zsolt Parragi
Description:
The function contains the following code:

default:
    DBUG_ASSERT(0);                            // should not come here
    return;          // don't crash production builds, just do nothing

While this is definitely an unlikely case even in release builds, unfortunately a mutex is locked above this return, and the early return will keep it locked.

If the correct behavior of the release build in this case is really important, the mutex should be unlocked:

    // don't crash production builds, just do nothing
    mysql_mutex_unlock(&err_lock);
    return;

How to repeat:
Found while analyzing clang compilation warnings

Suggested fix:
    // don't crash production builds, just do nothing
    mysql_mutex_unlock(&err_lock);
    return;
[26 Jan 2018 13:31] MySQL Verification Team
Hi!

Thank you for your bug report.

Your analysis is correct, although this is indeed, very insignificant bug, happening in debug binaries only.

Verified.
[26 Jan 2018 16:09] Zsolt Parragi
Hello

While I agree that it's not a major bug, a small correction: it can happen only in release binaries, not debug - in debugs, the assert before the return stops the server.
[13 Feb 2018 10:57] Zsolt Parragi
Adding a mutex unlock

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: missing-mutex.patch (text/x-patch), 554 bytes.

[20 Jun 2018 11:11] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.13:

In code for replication slave reporting, a rare error situation raised an assertion in debug builds, but in release builds, returned leaving a mutex locked. The mutex is now unlocked before returning in this situation. Thanks to Zsolt Parragi for the patch.