-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add error messages when malloc allocator hits capacity limit #8075
Add error messages when malloc allocator hits capacity limit #8075
Conversation
✅ Deploy Preview for meta-velox canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bikramSingh91 thanks for the change!
"total allocation of {} pages, the memory allocator capacity is {}", | ||
mix.totalPages, | ||
numPages, | ||
succinctBytes(capacity_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want add a log with VELOX_MEM_LOG_EVERY_MS?
Also we could consider to add a static utility in MemoryAllocator::logAllocationError(const std::string& errMsg); It seems that have bee used in more than one places? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts come to mind:
-
It's possible to incorporate VELOX_MEM_LOG_EVERY_MS into setAllocatorFailureMessage, which could potentially eliminate the need for an additional function call.
-
However, on second thought there are situations where logging every time is necessary, so this approach may not result in significant cleanup.
(examplevelox/velox/common/memory/MmapAllocator.cpp
Line 139 in 050c16c
VELOX_MEM_LOG(WARNING) << errorMsg; -
Finally, adding VELOX_MEM_LOG_EVERY_MS inside a function would mean that it gets invoked everytime we log an error, so the 1000th iteration can be for any of those error messages and we might miss some (not sure if forcing an inline function can offset this).
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it might be better not to log inside setAllocatorFailureMessage
808e9ef
to
c5fa308
Compare
@bikramSingh91 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bikramSingh91 thanks for the update!
"total allocation of {} pages, the memory allocator capacity is {}", | ||
mix.totalPages, | ||
numPages, | ||
succinctBytes(capacity_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it might be better not to log inside setAllocatorFailureMessage
VELOX_MEM_LOG_EVERY_MS(WARNING, 1000) | ||
<< "Failed to allocateBytes " << succinctBytes(bytes) | ||
<< ": Exceeded memory allocator capacity limit of " | ||
<< succinctBytes(capacity_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to set allocation error message here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added and also added corresponding unit tests
c5fa308
to
6bfc987
Compare
@bikramSingh91 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bikramSingh91 LGTM. Thanks!
velox/common/memory/MemoryPool.cpp
Outdated
@@ -408,11 +408,13 @@ MemoryPoolImpl::~MemoryPoolImpl() { | |||
|
|||
if (isLeaf()) { | |||
if (usedReservationBytes_ > 0) { | |||
LOG(ERROR) << "Bad memory usage track state : " << toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about?
Used memory leak:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used this instead to make it consistent with the reserved memory leak message:
Memory leak (Used memory):
velox/common/memory/MemoryPool.cpp
Outdated
RECORD_METRIC_VALUE( | ||
kMetricMemoryPoolUsageLeakBytes, usedReservationBytes_); | ||
} | ||
|
||
if (minReservationBytes_ > 0) { | ||
LOG(ERROR) << "Bad memory usage track state : " << toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memory reservation leak:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used this instead to make it consistent with the used memory leak message:
Memory leak (Reserved memory):
6bfc987
to
ecf95ca
Compare
@bikramSingh91 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Adds useful error messages when capacity limit is hit while using MallocAllocator Added a log line in the memory pool leak checking codepath that would help attribute leaks to its respective query in non-debug builds. Test Plan: Added unit tests
ecf95ca
to
35a7736
Compare
@bikramSingh91 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@bikramSingh91 merged this pull request in 4ab8c0d. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Adds useful error messages when capacity limit is hit while
using MallocAllocator
Added a log line in the memory pool leak checking codepath
that would help attribute leaks to its respective query in
non-debug builds.
Test Plan:
Added unit tests