Skip to content

MDEV-37491: Assertion (mem_root->flags & 4) == 0 failed in void *alloc_root(MEM_ROOT *, size_t)#4952

Draft
raghunandanbhat wants to merge 1 commit into11.8from
11.8-mdev-37491
Draft

MDEV-37491: Assertion (mem_root->flags & 4) == 0 failed in void *alloc_root(MEM_ROOT *, size_t)#4952
raghunandanbhat wants to merge 1 commit into11.8from
11.8-mdev-37491

Conversation

@raghunandanbhat
Copy link
Copy Markdown
Contributor

fixes MDEV-37491

Problem:

Server crashes when a procedure with default parameter is executed and default value for the parameter is evaluated after the procedure's first execution.

  CREATE PROCEDURE p(x INT DEFAULT (SELECT 1)) ...
  CALL p(1); -- first exec, marks mem_root read-only
  CALL p(); -- tries to allocate on locked when executing DEFAULT

Fix:

Temporarily clear the read-only flag on the statement memory root to allow the allocation. Also adds a debug hook to verify allocation happens not more than once per prepared statement and per internal table added to the list.

…lloc_root(MEM_ROOT *, size_t)`

Problem:
  Server crashes when a procedure with default parameter is executed and
  default value for the parameter is evaluated after the procedure's
  first execution.

  CREATE PROCEDURE p(x INT DEFAULT (SELECT 1)) ...
  CALL p(1); -- first exec, marks mem_root read-only
  CALL p(); -- tries to allocate on locked when executing DEFAULT

Fix:
  Temporarily clear the read-only flag on the statement memory root to
  allow the allocation. Also adds a debug hook to verify allocation
  happens not more than once per prepared statement and per internal
  table added to the list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant