Skip to content

Commit fe8326a

Browse files
yanwr1yjhjstz
authored andcommitted
print log message with write_stderr when reach vmem or resgroup limit.
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.
1 parent 566a3d8 commit fe8326a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/backend/utils/mmgr/memprot.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,13 @@ static void gp_failed_to_alloc(MemoryAllocationStatus ec, int en, int sz)
315315
}
316316
else if (ec == MemoryFailure_VmemExhausted)
317317
{
318-
elog(LOG, "Logging memory usage for reaching Vmem limit");
318+
/*
319+
* The memory usage have reached Vmem limit, it will loop in gp_malloc
320+
* and gp_failed_to_alloc if new allocation happens, and then errors out
321+
* with "ERRORDATA_STACK_SIZE exceeded". We are therefore printing the
322+
* log message header using write_stderr.
323+
*/
324+
write_stderr("Logging memory usage for reaching Vmem limit");
319325
}
320326
else if (ec == MemoryFailure_SystemMemoryExhausted)
321327
{
@@ -330,7 +336,10 @@ static void gp_failed_to_alloc(MemoryAllocationStatus ec, int en, int sz)
330336
}
331337
else if (ec == MemoryFailure_ResourceGroupMemoryExhausted)
332338
{
333-
elog(LOG, "Logging memory usage for reaching resource group limit");
339+
/*
340+
* The behavior in resgroup group mode is the same as MemoryFailure_VmemExhausted.
341+
*/
342+
write_stderr("Logging memory usage for reaching resource group limit");
334343
}
335344
else
336345
elog(ERROR, "Unknown memory failure error code");

0 commit comments

Comments
 (0)