Bug #79093 MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS should be documented as non-terminable
Submitted: 3 Nov 2015 10:32 Modified: 23 Nov 2015 16:29
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Security: Audit Severity:S3 (Non-critical)
Version:5.7.9 OS:Any
Assigned to: CPU Architecture:Any
Tags: doc, plugin api

[3 Nov 2015 10:32] Laurynas Biveinis
Description:
https://dev.mysql.com/doc/refman/5.7/en/writing-audit-plugins.html

should list MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS as a non-terminable event.

How to repeat:
Check https://dev.mysql.com/doc/refman/5.7/en/writing-audit-plugins.html, section "Audit Plugin Error Handling", "Some events cannot be terminated:" list.

Suggested fix:
Add MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS to that list
[3 Nov 2015 11:08] MySQL Verification Team
Hello Laurynas,
 
Thank you for the report.

Thanks,
Umesh
[13 Nov 2015 14:24] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly.
[18 Nov 2015 14:21] Paul DuBois
It turns out that shutdown events *are* terminable, because termination occurs prior to shutdown actually starting. So: No change to the docs.
[19 Nov 2015 8:22] Laurynas Biveinis
This resolution needs further clarification, because I filed this bug after having confirmed that these events are non-terminable:

--- mysql-server/plugin/audit_null/audit_null.c 2015-11-04 12:50:46.000000000 +0200
+++ mysql-5.7.9/plugin/audit_null/audit_null.c  2015-11-19 10:20:58.000000000 +0200
@@ -487,6 +487,8 @@ static int audit_null_notify(MYSQL_THD t
     /* const struct mysql_event_server_shutdown *event_startup=
        (const struct mysql_event_server_shutdown *) event; */
     number_of_calls_server_shutdown++;
+    my_message(ER_AUDIT_API_ABORT, "Aborting shutdown!", MYF(0));
+    return 1;
   }
   else if (event_class == MYSQL_AUDIT_COMMAND_CLASS)
   {

foo-master.opt:

$AUDIT_NULL_OPT

foo-test:

--source include/have_null_audit_plugin.inc
--source include/not_embedded.inc

connection default;
let $expected_extension= so;
if(`SELECT CONVERT(@@version_compile_os USING latin1)
           IN ("Win32","Win64","Windows")`)
{
   let $expected_extension= dll;
}
--replace_result $expected_extension <expected_extension>
eval INSTALL PLUGIN null_audit SONAME 'adt_null.$expected_extension';

# If the shutdown event is terminable, the testcase should hang here
--shutdown_server 9000000

Running the above MTR shows the my_mesage diagnostics in the error, but the shutdown proceeds.