Skip to content

MDEV-38838 Memory loss in CONNECT from handler::ha_rnd_init#5050

Open
grooverdan wants to merge 1 commit into
MariaDB:10.11from
grooverdan:MDEV-38838
Open

MDEV-38838 Memory loss in CONNECT from handler::ha_rnd_init#5050
grooverdan wants to merge 1 commit into
MariaDB:10.11from
grooverdan:MDEV-38838

Conversation

@grooverdan

Copy link
Copy Markdown
Member

This was a leak in unixODBC 2.3.14 where a cache was allocated but not returned. The LD_PRELOAD is so the resolution will be aware of the resolution for save_ini_cache that caused the leak.

@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label May 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a leak suppression for unixODBC in the LSAN configuration and introduces logic to LD_PRELOAD the ODBC library within the test suite to ensure proper address resolution. Feedback focuses on improving the portability of the hardcoded library path, refining the LD_PRELOAD environment variable assignment to avoid leading colons, and correcting a typo in the documentation.

Comment thread storage/connect/mysql-test/connect/suite.pm
@grooverdan grooverdan force-pushed the MDEV-38838 branch 3 times, most recently from 26f81bc to dc53089 Compare May 8, 2026 03:30
@grooverdan grooverdan requested a review from vuvova May 8, 2026 04:14
@grooverdan grooverdan changed the title Memory loss in CONNECT from handler::ha_rnd_init MDEV-38838 Memory loss in CONNECT from handler::ha_rnd_init May 8, 2026
@grooverdan grooverdan force-pushed the MDEV-38838 branch 2 times, most recently from ab38449 to 051346a Compare May 11, 2026 01:36
This was a leak in <=unixODBC 2.3.15 where a cache was allocated
but not returned. Using the suite.pm for the connect engine
we see if the connect engine is compiled with ASAN (that includes
LeakSanitizer) and we check the unixODBC version to see if it is
a version (currently unreleased) that has a inst_logClose symbol
which is part of the unixODBC leak fix. If it is not a leak fixed
version, a LD_PRELOAD of the unixODBC library occurs so that the
LeakSanitizer suppression can resolve the save_ini_cache entry.

Alterates considered:
1. __clear_ini_cache in libodbcinst (2.3.12+) is an interface,
for which there is no header define. A CMake would need to
do full compile and link to check its existance. Workable,
just wanted a simplier solution. It looked like it shoud be a
better interface in unixODBC.

2. could skip asan tests on CONNECT/ODBC, but this is skipping
coverage we want.
RazvanLiviuVarzaru pushed a commit to MariaDB/buildbot that referenced this pull request Jun 5, 2026
unixodbc-dev has a memory leak. Apply patch from
upstream.

This will arrive in Debian stable eventtually

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1136221

Added the libodbccr (cursor) libraries to the MSAN since they
where built. Maybe be used at some stage.

Workaround still in review queue - MariaDB/server#5050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MariaDB Foundation Pull requests created by MariaDB Foundation

Development

Successfully merging this pull request may close these issues.

2 participants