Skip to content

Commit

Permalink
print log message with write_stderr when reach vmem or resgroup limit.
Browse files Browse the repository at this point in the history
When memory usage have reached Vmem limit or resource group limit, it
will loop in gp_malloc and gp_failed_to_alloc if new allocation happens,
and then errors out with "ERRORDATA_STACK_SIZE exceeded".

We are therefore printing the log message header using write_stderr.
  • Loading branch information
yanwr1 authored and yjhjstz committed Jan 20, 2025
1 parent 566a3d8 commit fe8326a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/backend/utils/mmgr/memprot.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ static void gp_failed_to_alloc(MemoryAllocationStatus ec, int en, int sz)
}
else if (ec == MemoryFailure_VmemExhausted)
{
elog(LOG, "Logging memory usage for reaching Vmem limit");
/*
* The memory usage have reached Vmem limit, it will loop in gp_malloc
* and gp_failed_to_alloc if new allocation happens, and then errors out
* with "ERRORDATA_STACK_SIZE exceeded". We are therefore printing the
* log message header using write_stderr.
*/
write_stderr("Logging memory usage for reaching Vmem limit");
}
else if (ec == MemoryFailure_SystemMemoryExhausted)
{
Expand All @@ -330,7 +336,10 @@ static void gp_failed_to_alloc(MemoryAllocationStatus ec, int en, int sz)
}
else if (ec == MemoryFailure_ResourceGroupMemoryExhausted)
{
elog(LOG, "Logging memory usage for reaching resource group limit");
/*
* The behavior in resgroup group mode is the same as MemoryFailure_VmemExhausted.
*/
write_stderr("Logging memory usage for reaching resource group limit");
}
else
elog(ERROR, "Unknown memory failure error code");
Expand Down

0 comments on commit fe8326a

Please sign in to comment.