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-35510 ASAN build crashes during bootstrap #3739

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DaveGosselin-MariaDB
Copy link
Member

Decouple a DML result's cleanup from the destructor semantics, allowing cleanup to occur without simultaneously deallocating memory.

The MYSQL_DML_DONE function would access the select_result_interceptor implementation (in either the cases of UPDATE or DELETE) after that interceptor instance's destructor had been called. Most of the time this works because the instance was allocated on the statement memroot which continues to live on and no other allocations are made at this point. The interceptor instance's destructor would be called during either Sql_cmd_update::execute_inner or Sql_cmd_delete::execute_inner by an explicit call to delete. Since the result instance lives on the memroot associated with the current command, we can avoid calling the destructor via delete and instead invoke a cleanup method, deferring the memory deallocation to free_root when the command's processing has completed.

Decouple a DML result's cleanup from the destructor semantics, allowing
cleanup to occur without simultaneously deallocating memory.

The MYSQL_DML_DONE function would access the select_result_interceptor
implementation (in either the cases of UPDATE or DELETE) after that
interceptor instance's destructor had been called.  Most of the time
this works because the instance was allocated on the statement memroot
which continues to live on and no other allocations are made at this point.
The interceptor instance's destructor would be called during either
Sql_cmd_update::execute_inner or Sql_cmd_delete::execute_inner by an
explicit call to delete.  Since the result instance lives on the
memroot associated with the current command, we can avoid calling the
destructor via delete and instead invoke a cleanup method, deferring
the memory deallocation to free_root when the command's processing has
completed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant