facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.48k stars 712 forks source link

Do not try to access plugin name for unloaded plugins #1283

Closed laurynas-biveinis closed 1 year ago

laurynas-biveinis commented 1 year ago

If early plugin initialization fails, the plugin is unloaded with its entry remaining in plugin_array with PLUGIN_IS_FREED. The unloading of plugin will call dlclose, potentially unmapping its memory, including the plugin name constant. This may cause a crash in plugin_init_initialize_and_reap in the code which delays the raft plugin initialization by comparing its name. The crash is seen on macOS, MTR test perfschema.table_plugin_early_load, on a sanitizer-less build (enabling sanitizers disables the dlclose call).

Fix by moving plugin name check after the plugin state check, which excludes the PLUGIN_IS_FREED entries.

Squash with 0cf9341ab0a9751a8895dd073fc6ae9f3aa0bd89

facebook-github-bot commented 1 year ago

@sunshine-Chun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

sunshine-Chun commented 1 year ago

Is this change data dictionary related?

laurynas-biveinis commented 1 year ago

It is a pre-existing regression that is visible on one of the DD-related testcases