MDEV-38838 Memory loss in CONNECT from handler::ha_rnd_init#5050
Open
grooverdan wants to merge 3 commits into
Open
MDEV-38838 Memory loss in CONNECT from handler::ha_rnd_init#5050grooverdan wants to merge 3 commits into
grooverdan wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
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.
26f81bc to
dc53089
Compare
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.
Its useful to add own LSAN_OPTIONS like report_objects=1 so lets make sure MTR doesn't overwrite this.
When we have a rr recording of the process, a memory location
is a useful thing to have in the err log of leaks.
The output comes out like:
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x55b08dbccdb8 in malloc (/build/sql/mariadbd+0x1b89db8) (BuildId: 4d72569bed63ce1fbf55d51e4d4a84b610efd87d)
#1 0x7b3fe387a1b1 (<unknown module>)
#2 0x7b3fe37c492f (<unknown module>)
#3 0x7b3fe3058407 (<unknown module>)
#4 0x7b3fe2f09493 (<unknown module>)
Objects leaked above:
0x7b7feafe0990 (40 bytes)
Now once the location is resolved we can check that we resolving the
right object leak.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.