You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "AngersZhuuuu (via GitHub)" <gi...@apache.org> on 2025/12/23 10:37:05 UTC
[PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
AngersZhuuuu opened a new pull request, #53578:
URL: https://github.com/apache/spark/pull/53578
### What changes were proposed in this pull request?
These days I am checking cluster's OOM failed APP, I found allocate failed didn't log out the error stack. A little not friendly for user check app.
Such as user set 200M broadcast threshold, but allocate 4G memory
```
25/12/21 07:08:13 WARN [broadcast-exchange-4] TaskMemoryManager: Failed to allocate a page (4294967296 bytes), try again.
25/12/21 07:08:58 WARN [broadcast-exchange-4] TaskMemoryManager: Failed to allocate a page (4294967296 bytes), try again.
```
### Why are the changes needed?
Help user debug
### Does this PR introduce _any_ user-facing change?
User can know allocate what memory failed
### How was this patch tested?
No
### Was this patch authored or co-authored using generative AI tooling?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #53578: [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage
URL: https://github.com/apache/spark/pull/53578
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2644722207
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -390,7 +390,7 @@ public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
- logger.warn("Failed to allocate a page ({} bytes), try again.",
+ logger.warn("Failed to allocate a page ({} bytes), try again.", e,
Review Comment:
How about current?
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -390,7 +390,7 @@ public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
- logger.warn("Failed to allocate a page ({} bytes), try again.",
+ logger.warn("Failed to allocate a page ({} bytes), try again.", e,
Review Comment:
How about current? @dongjoon-hyun
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2646778726
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -364,7 +368,10 @@ public long pageSizeBytes() {
*
* @throws TooLargePageException
*/
- public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
+ public MemoryBlock allocatePage(
+ long size,
+ MemoryConsumer consumer,
+ boolean isRetry) {
Review Comment:
Done, how about current code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2644722943
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -364,7 +368,10 @@ public long pageSizeBytes() {
*
* @throws TooLargePageException
*/
- public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
+ public MemoryBlock allocatePage(
+ long size,
+ MemoryConsumer consumer,
+ boolean isRetry) {
Review Comment:
Add. this avoid print too much stack information.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2646768033
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -364,7 +368,10 @@ public long pageSizeBytes() {
*
* @throws TooLargePageException
*/
- public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
+ public MemoryBlock allocatePage(
+ long size,
+ MemoryConsumer consumer,
+ boolean isRetry) {
Review Comment:
given we are touching this place, can we use `int retryCount` instead of a boolean? And we can also log the retry count.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on PR #53578:
URL: https://github.com/apache/spark/pull/53578#issuecomment-3686125309
gentle ping @cloud-fan @dongjoon-hyun WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2644303972
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -390,7 +390,7 @@ public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
- logger.warn("Failed to allocate a page ({} bytes), try again.",
+ logger.warn("Failed to allocate a page ({} bytes), try again.", e,
Review Comment:
Could you add the new error message to the PR description too, @AngersZhuuuu ?
You can compare it via `**BEFORE**` and `**AFTER**`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #53578:
URL: https://github.com/apache/spark/pull/53578#issuecomment-3692736132
thanks, merging to master!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2644758390
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -390,16 +397,21 @@ public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
- logger.warn("Failed to allocate a page ({} bytes), try again.",
- MDC.of(LogKeys.PAGE_SIZE, acquired));
+ if (!isRetry) {
+ logger.warn("Failed to allocate a page ({} bytes), try again.", e,
+ MDC.of(LogKeys.PAGE_SIZE, acquired));
+ } else {
+ logger.warn("Failed to allocate a page ({} bytes), try again.",
+ MDC.of(LogKeys.PAGE_SIZE, acquired));
+ }
// there is no enough memory actually, it means the actual free memory is smaller than
// MemoryManager thought, we should keep the acquired memory.
synchronized (this) {
acquiredButNotUsed += acquired;
allocatedPages.clear(pageNumber);
}
// this could trigger spilling to free some pages.
- return allocatePage(size, consumer);
+ return allocatePage(size, consumer, true);
Review Comment:
not related to this PR, but the retry is infinite?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2644909898
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -390,16 +397,21 @@ public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
- logger.warn("Failed to allocate a page ({} bytes), try again.",
- MDC.of(LogKeys.PAGE_SIZE, acquired));
+ if (!isRetry) {
+ logger.warn("Failed to allocate a page ({} bytes), try again.", e,
+ MDC.of(LogKeys.PAGE_SIZE, acquired));
+ } else {
+ logger.warn("Failed to allocate a page ({} bytes), try again.",
+ MDC.of(LogKeys.PAGE_SIZE, acquired));
+ }
// there is no enough memory actually, it means the actual free memory is smaller than
// MemoryManager thought, we should keep the acquired memory.
synchronized (this) {
acquiredButNotUsed += acquired;
allocatedPages.clear(pageNumber);
}
// this could trigger spilling to free some pages.
- return allocatePage(size, consumer);
+ return allocatePage(size, consumer, true);
Review Comment:
From a retry logic perspective, this part allows for an infinite number of retries.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2646878826
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -364,7 +368,10 @@ public long pageSizeBytes() {
*
* @throws TooLargePageException
*/
- public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
+ public MemoryBlock allocatePage(
Review Comment:
can this be private now?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54818][SQL] TaskMemoryManager allocate failed should log errorstack to help check memory usage [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on code in PR #53578:
URL: https://github.com/apache/spark/pull/53578#discussion_r2646983112
##########
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java:
##########
@@ -364,7 +368,10 @@ public long pageSizeBytes() {
*
* @throws TooLargePageException
*/
- public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
+ public MemoryBlock allocatePage(
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org