Skip to content

MDEV-39831 mtr to handle LSAN_OPTIONS better#5168

Open
grooverdan wants to merge 2 commits into
MariaDB:10.11from
grooverdan:MDEV-39831
Open

MDEV-39831 mtr to handle LSAN_OPTIONS better#5168
grooverdan wants to merge 2 commits into
MariaDB:10.11from
grooverdan:MDEV-39831

Conversation

@grooverdan
Copy link
Copy Markdown
Member

extend, rather than overwrite LSAN_OPTIONS.

report_objects when recording under rr. Only has an effect if ASAN is there.

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.
@grooverdan grooverdan requested a review from vuvova June 3, 2026 01:52
@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label Jun 3, 2026
Copy link
Copy Markdown

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

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 updates the test suite configuration to preserve existing LSAN_OPTIONS environment variables when setting new options. However, the current implementation can append a trailing colon when LSAN_OPTIONS is empty or undefined, which may trigger syntax warnings from LSAN/ASAN and cause test failures. Additionally, a missing semicolon in mysql-test/lib/My/Debugger.pm should be fixed to ensure valid Perl syntax.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

push @::global_suppressions, qr/InnoDB: native AIO failed/;
::mtr_error('rr requires kernel.perf_event_paranoid <= 1')
if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1;
$ENV{LSAN_OPTIONS}= "report_objects=1:" . ($ENV{LSAN_OPTIONS} || '')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Appending a trailing colon when $ENV{LSAN_OPTIONS} is empty or undefined can lead to syntax warnings from LSAN/ASAN (e.g., complaining about empty options or missing =). Since mtr is highly sensitive to unexpected output on stderr, these warnings can cause test failures. Additionally, a terminating semicolon should be added to ensure robust Perl syntax.

We can conditionally append the colon only when $ENV{LSAN_OPTIONS} is non-empty.

      $ENV{LSAN_OPTIONS}= "report_objects=1" . ($ENV{LSAN_OPTIONS} ? ":$ENV{LSAN_OPTIONS}" : "");

Comment on lines +1647 to +1648
$ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp:print_suppressions=0:"
. ($ENV{LSAN_OPTIONS} || '')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Appending a trailing colon when $ENV{LSAN_OPTIONS} is empty or undefined can lead to syntax warnings from LSAN/ASAN. We should conditionally append the colon only when $ENV{LSAN_OPTIONS} is non-empty.

  $ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp:print_suppressions=0"
     . ($ENV{LSAN_OPTIONS} ? ":$ENV{LSAN_OPTIONS}" : "")

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