-
Couldn't load subscription status.
- Fork 3.6k
[Chore](utils) make Defer allow throw exception #57275
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
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
run buildall |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
be/src/util/defer_op.h
Outdated
| throw; | ||
| } catch (const std::exception& e) { | ||
| LOG(WARNING) << "Exception swallowed in Defer destructor during unwind: " | ||
| << e.what(); |
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.
In this case, should print stack here, we should know where the exception happens.
|
run buildall |
1 similar comment
|
run buildall |
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.
LGTM
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
run buildall |
What problem does this PR solve?
This pull request improves the safety and robustness of the
Deferutility by enhancing its exception handling during destruction and adds unit tests to verify the new behavior. The main focus is to ensure that exceptions thrown by deferred closures are handled correctly, especially during stack unwinding, to prevent unexpected program termination.Enhancements to exception handling in
Defer:Deferclass indefer_op.hto distinguish between normal destruction and stack unwinding:std::terminate.noexcept(false)to permit this. [1] [2]Testing improvements:
defer_op_test.cppwith unit tests to verify:Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)