MDEV-29579 Fix CONNECT ASAN hits (#2277)
There are currently two things causing ASAN hits on CONNECT engine when the plugin is used as a dynamic module. These are libxml2 and libodbc. libxml2 has some quirks when not the first and last thing called in the main thread of an application, some of the global memory isn't cleaned up correctly. The same is assumed of libodbc but this does not have explicit API for this. This is being fixed in two ways. First we are removing the libxml2 cleanup call. This is because the current one is messy and whatever it fixed has gone away. But also because if this is called and libxml2 is used again this can cause issues. For example if two different plugins to MariaDB both happen to use libxml2. The second fix is a hack that exploits `STB_GNU_UNIQUE` so that when compiled with ASAN the plugin will remain in memory after dlclose(). This allows libodbc to cleanup and has the added advatage that we will get clean stacks from ASAN for CONNECT when the leak is detected at the end of execution. Details of the `STB_GNU_UNIQUE` method can be found here: https://web.archive.org/web/20100730094324/http://www.redhat.com/archives/posix-c++-wg/2009-August/msg00002.html
Showing
Please register or sign in to comment