-
Notifications
You must be signed in to change notification settings - Fork 196
Fix std::terminate() caused by uncaught exception in ORCA #1481
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
Conversation
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.
Hi, @NJrslv welcome!🎊 Thanks for taking the effort to make our project better! 🙌 Keep making such awesome contributions!
|
👍 |
|
Thanks for the PR, which is a good start 😄 |
|
That would be better to have a commit message title and message body when merging this PR. Can follow the template. |
|
If I am not the one squashing and merging this PR, I have provided the commit message and body below for the merger to copy & paste |
What does this PR do?
This PR fixes a crash,
std::terminate(), caused by an exception occurring in the catch block ofGPOPTOptimizedPlan()duringgpopt_context.CloneErrorMsg().When
CloneErrorMsgfails (typically due to OOM), it throws agpdberror, causingstd::terminate().Postgres has graceful error handling for errors that occur while processing other errors - even during OOM, the
ErrorContexthas reserved space to preserve error messages.So rethrow the error to postgres handler.
Test Plan
Added a new test to the regression
gporca_faulttest.I added a query that errors out during optimization in orca and as the result falls into
catchblock where another exception inCloneErrorMsgis thrown via inject fault.Previously it resulted in the
std::terminate()call & process crashing. Now catch the exception and let the postgres handle it with reserved buffer to preserve error message.Impact
Instead of
server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.postgres reports an error (in case of OOM we will see it, not std::terminate with exiting processes):