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

error in PolicyEagerFreeAssignOperatorMemoryKB makes query end without calling mppExecutorCleanup #12690

Closed
violet2016 opened this issue Oct 13, 2021 · 2 comments · Fixed by #12694
Assignees

Comments

@violet2016
Copy link
Member

Bug Report

In GPDB6, when memory is limit, query could throw an error "insufficient memory reserved for statement" without calling mppExecutorCleanup function and left some hooks should be called in the function not called at all.

Greenplum version or build

6.17.5

OS version and uname -a

centos 7

autoconf options used ( config.status --config )

Installation information ( pg_config )

Expected behavior

mppExecutorCleanup should be called at the end whenever an error happened.

Actual behavior

Step to reproduce the behavior

  1. attach a running gpdb postgres connecton process with gdb, set breakpoints at PolicyEagerFreeAssignOperatorMemoryKB and mppExecutorCleanup
  2. run a query like "select 1" with the postgres connection
  3. when break at PolicyEagerFreeAssignOperatorMemoryKB, step before the condition line of the errmsg
  4. set ctx.groupTree->groupMemKB to 1
  5. the error will occure
  6. You can see gdb not stop at the breakpoint of mppExecutorCleanup
@Aegeaner Aegeaner self-assigned this Oct 14, 2021
adam8157 pushed a commit that referenced this issue May 25, 2022
…rt (#12694)

According to a reported error in PolicyEagerFreeAssignOperatorMemoryKB makes                                                                                                                                                           query end without calling mppExecutorCleanup #12690, the code path in                                                                                                                                                                  `standard_ExecutorStart` didn't handle exception in
`PolicyAutoAssignOperatorMemoryKB` and `PolicyEagerFreeAssignOperatorMemoryKB`
calling, which may cause the OOM exception not to be handled in
`standard_ExecutorStart` but throw to upper `PortalStart` methods, while there
is also an exception handling mechanism in `PortalStart` but `mppExecutorCleanup`
will not call because `portal->queryDesc` will be `NULL` in certain transaction states.

This commit fixes it.
Aegeaner added a commit to Aegeaner/gpdb that referenced this issue May 25, 2022
…rt (greenplum-db#12694)

According to a reported error in PolicyEagerFreeAssignOperatorMemoryKB makes                                                                                                                                                           query end without calling mppExecutorCleanup greenplum-db#12690, the code path in                                                                                                                                                                  `standard_ExecutorStart` didn't handle exception in
`PolicyAutoAssignOperatorMemoryKB` and `PolicyEagerFreeAssignOperatorMemoryKB`
calling, which may cause the OOM exception not to be handled in
`standard_ExecutorStart` but throw to upper `PortalStart` methods, while there
is also an exception handling mechanism in `PortalStart` but `mppExecutorCleanup`
will not call because `portal->queryDesc` will be `NULL` in certain transaction states.

This commit fixes it.
adam8157 pushed a commit that referenced this issue Jul 7, 2022
…tart()

According to a reported error in `PolicyEagerFreeAssignOperatorMemoryKB()`
makes query end without calling `mppExecutorCleanup()` #12690, the code path
in `standard_ExecutorStart()` didn't handle exception in
`PolicyAutoAssignOperatorMemoryKB()` and `PolicyEagerFreeAssignOperatorMemoryKB()`
calling, which may cause the OOM exception not to be handled in
`standard_ExecutorStart()` but throw to upper `PortalStart()` methods, while there
is also an exception handling mechanism in `PortalStart()` but `mppExecutorCleanup()`
will not call because `portal->queryDesc` will be `NULL` in certain transaction states.
24nishant pushed a commit to 24nishant/gpdb that referenced this issue Oct 17, 2022
…tart()

According to a reported error in `PolicyEagerFreeAssignOperatorMemoryKB()`
makes query end without calling `mppExecutorCleanup()` greenplum-db#12690, the code path
in `standard_ExecutorStart()` didn't handle exception in
`PolicyAutoAssignOperatorMemoryKB()` and `PolicyEagerFreeAssignOperatorMemoryKB()`
calling, which may cause the OOM exception not to be handled in
`standard_ExecutorStart()` but throw to upper `PortalStart()` methods, while there
is also an exception handling mechanism in `PortalStart()` but `mppExecutorCleanup()`
will not call because `portal->queryDesc` will be `NULL` in certain transaction states.
@adam8157
Copy link
Contributor

adam8157 commented Dec 20, 2022

Status summary: the first fix (#12694) has a problem, so we reverted it on the 6X_STABLE, and had the following fix (#13870) on the main branch.

adam8157 added a commit to adam8157/gpdb that referenced this issue Dec 20, 2022
Issue greenplum-db#12690, the code path in `standard_ExecutorStart` didn't handle
exception of `Policy*AssignOperatorMemoryKB`, which may cause the OOM
exception not handled in `standard_ExecutorStart` but throw to upper
`PortalStart` methods, in that case the hook needed by GPCC will not
be called. This commit fixed the issue.
@adam8157
Copy link
Contributor

The new 6X version fix: #14677

adam8157 added a commit that referenced this issue Jan 10, 2023
Issue #12690, the code path in `standard_ExecutorStart` didn't handle
exception of `Policy*AssignOperatorMemoryKB`, which may cause the OOM
exception not handled in `standard_ExecutorStart` but throw to upper
`PortalStart` methods, in that case the hook needed by GPCC will not
be called. This commit fixed the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants