You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/11/09 17:12:58 UTC
[GitHub] [doris] xinyiZzz opened a new pull request, #14135: [enhancement](memory) Support try catch bad alloc
xinyiZzz opened a new pull request, #14135:
URL: https://github.com/apache/doris/pull/14135
# Proposed changes
Issue Number: close #xxx
## Problem summary
Added a macro `RETURN_IF_CATCH_BAD_ALLOC` to catch `bad alloc` and return `Status::MemoryLimitExceeded`. Large memory allocations should use this macro in the future.
For tcmalloc, the returned `Status::MemoryLimitExceeded` has only bad alloc errors.
For jemalloc, the returned `Status::MemoryLimitExceeded` additionally contains mem tracker statistics, and because the mem limit is checked before the actual memory application, it can effectively avoid OOM.
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
2. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
3. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Does it need to update dependencies:
- [ ] Yes
- [ ] No
5. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xinyiZzz commented on a diff in pull request #14135: [enhancement](memory) Support try catch bad alloc
Posted by GitBox <gi...@apache.org>.
xinyiZzz commented on code in PR #14135:
URL: https://github.com/apache/doris/pull/14135#discussion_r1019178214
##########
be/src/runtime/thread_context.h:
##########
@@ -299,33 +300,87 @@ class StopCheckThreadMemTrackerLimit {
tracker->transfer_to( \
size, doris::thread_context()->_thread_mem_tracker_mgr->limiter_mem_tracker_raw())
+// Consider catching other memory errors, such as memset failure, etc.
+#define RETURN_IF_CATCH_BAD_ALLOC(stmt) \
+ do { \
+ doris::thread_context()->_thread_mem_tracker_mgr->clear_exceed_mem_limit_msg(); \
+ if (doris::thread_context()->enable_thread_cache_bad_alloc) { \
+ try { \
+ { stmt; } \
+ } catch (std::bad_alloc const&) { \
+ return Status::MemoryLimitExceeded( \
+ fmt::format("PreCatch Bad Alloc: {}", \
+ doris::thread_context() \
+ ->_thread_mem_tracker_mgr->exceed_mem_limit_msg())); \
+ } \
+ } else { \
+ try { \
+ doris::thread_context()->enable_thread_cache_bad_alloc = true; \
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] dataroaring merged pull request #14135: [enhancement](memory) Support try catch bad alloc
Posted by GitBox <gi...@apache.org>.
dataroaring merged PR #14135:
URL: https://github.com/apache/doris/pull/14135
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] hello-stephen commented on pull request #14135: [enhancement](memory) Support try catch bad alloc
Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #14135:
URL: https://github.com/apache/doris/pull/14135#issuecomment-1309140994
TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 34.38 seconds
load time: 447 seconds
storage size: 17176933008 Bytes
https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221109175919_clickbench_pr_43001.html
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #14135: [enhancement](memory) Support try catch bad alloc
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14135:
URL: https://github.com/apache/doris/pull/14135#issuecomment-1312621502
PR approved by anyone and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #14135: [enhancement](memory) Support try catch bad alloc
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14135:
URL: https://github.com/apache/doris/pull/14135#issuecomment-1312621495
PR approved by at least one committer and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei commented on a diff in pull request #14135: [enhancement](memory) Support try catch bad alloc
Posted by GitBox <gi...@apache.org>.
yiguolei commented on code in PR #14135:
URL: https://github.com/apache/doris/pull/14135#discussion_r1018605314
##########
be/src/runtime/thread_context.h:
##########
@@ -299,33 +300,87 @@ class StopCheckThreadMemTrackerLimit {
tracker->transfer_to( \
size, doris::thread_context()->_thread_mem_tracker_mgr->limiter_mem_tracker_raw())
+// Consider catching other memory errors, such as memset failure, etc.
+#define RETURN_IF_CATCH_BAD_ALLOC(stmt) \
+ do { \
+ doris::thread_context()->_thread_mem_tracker_mgr->clear_exceed_mem_limit_msg(); \
+ if (doris::thread_context()->enable_thread_cache_bad_alloc) { \
+ try { \
+ { stmt; } \
+ } catch (std::bad_alloc const&) { \
+ return Status::MemoryLimitExceeded( \
+ fmt::format("PreCatch Bad Alloc: {}", \
+ doris::thread_context() \
+ ->_thread_mem_tracker_mgr->exceed_mem_limit_msg())); \
+ } \
+ } else { \
+ try { \
+ doris::thread_context()->enable_thread_cache_bad_alloc = true; \
Review Comment:
using Defer defer here. because if user add a return stmt in params the context is not set back.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org