Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-34502 InnoDB debug mode build - asserts with Valgrind #3378

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

grooverdan
Copy link
Member

  • The Jira issue number for this PR is: MDEV-34502

Description

\Valgrind looks at the assertions as examining uninitialized values.

As the assertions are tested in other Debug builds we know it isn't all invalid.

Account for Valgrind by removing the assertion under the WITH_VALGRIND=1 compilation.

Release Notes

N/A

How can this PR be tested?

Valgrind builder with newer 3.23.0 version run leaktest like:

mysql-test/mysql-test-run.pl --valgrind="--leak-check=summary --gen-suppressions=yes --num-callers=10" innodb.alter_not_null
If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the latest MariaDB development branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

Valgrind looks as the assertions as examining uninitalized values.

As the assertions are tested in other Debug builds we know
it isn't all invalid.

Account for Valgrind by removing the assertion under
the WITH_VALGRIND=1 compulation.
@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label Jul 1, 2024
@grooverdan grooverdan enabled auto-merge (rebase) July 3, 2024 09:32
@grooverdan grooverdan merged commit 25c6e3e into MariaDB:10.5 Jul 3, 2024
11 of 16 checks passed
@grooverdan grooverdan deleted the 10.5-MDEV-34502-valgrind-innodb branch July 3, 2024 10:07
Copy link
Contributor

@mariadb-DebarunBanerjee mariadb-DebarunBanerjee left a comment

Choose a reason for hiding this comment

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

Looks like, for these paths we have a nibble (half of the byte) of the last byte of variable n uninitialized. In the debug assert (& ~0xFFUL) and (n & ~0xFFFFU) should clear out the last byte so there is no issue in the debug assert but this is possibly the reason that valgrind is confused. In actual record the other parts are initialized later.

Although, it doesn't look very good adding these exception I guess it is ok for this case. I don't see how else we can address it. Zero Initializing the whole record after allocation may introduce performance regression as it is quite frequently used path.

Thanks for the patch. Please go ahead.

@grooverdan
Copy link
Member Author

should clear out the last byte

Is negated *~*0xFFFFU, so it clears, all except the last uninitialized byte. Technically it does read the uninit value, it just doesn't make such sense to report this as an error as the assertion purpose is to detect this. Technically valgrind can't tell the purpose of an assert.

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.

3 participants