← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2776)

 

#At lp:maria

 2776 knielsen@xxxxxxxxxxxxxxx	2009-12-02
      Fix PBXT crash during shutdown if shutdown happens early (like wrong command args).
      modified:
        storage/pbxt/src/myxt_xt.cc

=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- a/storage/pbxt/src/myxt_xt.cc	2009-12-01 09:50:46 +0000
+++ b/storage/pbxt/src/myxt_xt.cc	2009-12-02 14:19:34 +0000
@@ -3112,8 +3112,17 @@ xtPublic void *myxt_create_thread()
 	 * references to the PBXT plugin object and will effectively deadlock the plugin so 
 	 * that server will have to force plugin shutdown. To avoid deadlocking and forced shutdown 
 	 * we must dereference the plugin after creating THD objects.
+	 * Similarly to global_system_variables.table_plugin as described above,
+         * new_thd->valriables.table_plugin can also become NULL due to shutdown.
 	 */
-	LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(new_thd->variables.table_plugin)->name;
+        plugin_ref table_plugin = REF_MYSQL_PLUGIN(new_thd->variables.table_plugin);
+        if (!table_plugin) {
+          delete new_thd;
+          xt_register_xterr(XT_REG_CONTEXT, XT_ERR_MYSQL_NO_THREAD);
+          return NULL;
+	}
+
+	LEX_STRING& plugin_name = table_plugin->name;
 	if ((plugin_name.length == 4) && (strncmp(plugin_name.str, "PBXT", plugin_name.length) == 0)) {
 		REF_MYSQL_PLUGIN(new_thd->variables.table_plugin)->ref_count--;
 	}