gongxun0928 opened a new pull request, #1124:
URL: https://github.com/apache/cloudberry/pull/1124

   In the exception handling logic of interconnect_abort_callback, we invoked 
elog(ERROR) without properly handling the PostgreSQL exception using 
PG_TRY/PG_CATCH. This oversight could lead to the process exiting abnormally.
   
   When an uncaught PostgreSQL exception occurs in the exception handling 
function registered via RegisterResourceReleaseCallback, the exception callback 
function is recursively invoked. This recursion may eventually cause the 
errordata stack to exceed its allocated size, triggering an ERROR(PANIC) and 
causing the process to terminate abnormally.
   
   ```
   (gdb) p errordata
   $16 = {{elevel = 23, output_to_server = true, output_to_client = true, 
show_funcname = false, omit_location = false, fatal_return = false, hide_stmt = 
false, hide_ctx = false,
       filename = 0x7f6efa37649b "elog.c", lineno = 549, funcname = 
0x7f6efa376ce8 <__func__.42> "errstart", domain = 0x7f6efa376400 "postgres-14", 
context_domain = 0x7f6efa376400 "postgres-14",
       sqlerrcode = 2600, message = 0x849d050 "ERRORDATA_STACK_SIZE exceeded 
(elog.c:549)", detail = 0x0, detail_log = 0x0, hint = 0x0, context = 0x0, 
backtrace = 0x0,
       message_id = 0x7f6efa3764b8 "ERRORDATA_STACK_SIZE exceeded", schema_name 
= 0x0, table_name = 0x0, column_name = 0x0, datatype_name = 0x0, 
constraint_name = 0x0, cursorpos = 0, internalpos = 0,
       internalquery = 0x0, saved_errno = 107, stacktracearray = 
{0x7f6ef9e0d848 <errstart+600>, 0x7f6ef9833026 <errstart-6137290>, 
0x7f6ef5705f73 <TeardownTCPInterconnect-20637>,
         0x7f6ef570b99c <TeardownInterconnectTCP+28>, 0x7f6ef57098a7 
<interconnect_abort_callback+119>, 0x7f6ef9e4f2dd 
<ResourceOwnerReleaseInternal+157>,
         0x7f6ef9e4f27f <ResourceOwnerReleaseInternal+63>, 0x7f6ef99209f2 
<AbortTransaction+754>, 0x7f6ef992140d <AbortCurrentTransaction+93>, 
0x7f6ef9cbc54c <PostgresMain+828>,
         0x7f6ef9c1c6a0 <ServerLoop+4544>, 0x7f6ef9c1d6a3 
<PostmasterMain+3587>, 0x4027db <main+1387>, 0x7f6ef91175d0 
<__libc_start_call_main+128>, 0x7f6ef9117680 <__libc_start_main_impl+128>,
         0x402975 <_start+37>, 0x0 <repeats 14 times>}, stacktracesize = 16, 
printstack = false, assoc_context = 0x849cad8}, {elevel = 21, output_to_server 
= true, output_to_client = true,
       show_funcname = false, omit_location = true, fatal_return = false, 
hide_stmt = false, hide_ctx = false, filename = 0x7f6ef5725deb "ic_tcp.c", 
lineno = 2081,
       funcname = 0x7f6ef5726140 <__func__.10> "TeardownTCPInterconnect", 
domain = 0x7f6efa376400 "postgres-14", context_domain = 0x7f6efa376400 
"postgres-14", sqlerrcode = 16896517,
       message = 0x849d0c0 "Interconnect Error: Unexpected Motion Node Id: 4 
(size 10). This means a motion node that wasn't setup is requesting 
interconnect resources.", detail = 0x0,
       detail_log = 0x0, hint = 0x0, context = 0x0, backtrace = 0x0,
       message_id = 0x7f6ef5724108 "Interconnect Error: Unexpected Motion Node 
Id: %d (size %d). This means a motion node that wasn't setup is requesting 
interconnect resources.", schema_name = 0x0,
       table_name = 0x0, column_name = 0x0, datatype_name = 0x0, 
constraint_name = 0x0, cursorpos = 0, internalpos = 0, internalquery = 0x0, 
saved_errno = 107, stacktracearray = {
         0x7f6ef9e0d848 <errstart+600>, 0x7f6ef5705f73 
<TeardownTCPInterconnect-20637>, 0x7f6ef570b99c <TeardownInterconnectTCP+28>, 
0x7f6ef9ab45eb <mppExecutorCleanup+91>,
         0x7f6ef9aa5e7b <standard_ExecutorEnd+1067>, 0x7f6ef9a4387f 
<PortalCleanup+95>, 0x7f6ef9e4c272 <PortalDrop+50>, 0x7f6ef9cbaba4 
<exec_mpp_query+1268>, 0x7f6ef9cbe47d <PostgresMain+8813>,
         0x7f6ef9c1c6a0 <ServerLoop+4544>, 0x7f6ef9c1d6a3 
<PostmasterMain+3587>, 0x4027db <main+1387>, 0x7f6ef91175d0 
<__libc_start_call_main+128>, 0x7f6ef9117680 <__libc_start_main_impl+128>,
         0x402975 <_start+37>, 0x0 <repeats 15 times>}, stacktracesize = 15, 
printstack = false, assoc_context = 0x849cad8}, {elevel = 21, output_to_server 
= true, output_to_client = true,
       show_funcname = false, omit_location = true, fatal_return = false, 
hide_stmt = false, hide_ctx = false, filename = 0x7f6ef5725deb "ic_tcp.c", 
lineno = 2081,
   
   <!-- Thank you for your contribution to Apache Cloudberry (Incubating)! -->
   
   Fixes #ISSUE_Number
   
   ### What does this PR do?
   <!-- Brief overview of the changes, including any major features or fixes -->
   
   ### Type of Change
   - [ ] Bug fix (non-breaking change)
   - [ ] New feature (non-breaking change)
   - [ ] Breaking change (fix or feature with breaking changes)
   - [ ] Documentation update
   
   ### Breaking Changes
   <!-- Remove if not applicable. If yes, explain impact and migration path -->
   
   ### Test Plan
   <!-- How did you test these changes? -->
   - [ ] Unit tests added/updated
   - [ ] Integration tests added/updated
   - [ ] Passed `make installcheck`
   - [ ] Passed `make -C src/test installcheck-cbdb-parallel`
   
   ### Impact
   <!-- Remove sections that don't apply -->
   **Performance:**
   <!-- Any performance implications? -->
   
   **User-facing changes:**
   <!-- Any changes visible to users? -->
   
   **Dependencies:**
   <!-- New dependencies or version changes? -->
   
   ### Checklist
   - [ ] Followed [contribution 
guide](https://cloudberry.apache.org/contribute/code)
   - [ ] Added/updated documentation
   - [ ] Reviewed code for security implications
   - [ ] Requested review from [cloudberry 
committers](https://github.com/orgs/apache/teams/cloudberry-committers)
   
   ### Additional Context
   <!-- Any other information that would help reviewers? Remove if none -->
   
   ### CI Skip Instructions
   <!--
   To skip CI builds, add the appropriate CI skip identifier to your PR title.
   The identifier must:
   - Be in square brackets []
   - Include the word "ci" and either "skip" or "no"
   - Only use for documentation-only changes or when absolutely necessary
   -->
   
   ---
   <!-- Join our community:
   - Mailing list: 
[d...@cloudberry.apache.org](https://lists.apache.org/list.html?d...@cloudberry.apache.org)
 (subscribe: dev-subscr...@cloudberry.apache.org)
   - Discussions: https://github.com/apache/cloudberry/discussions -->
   


-- 
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-unsubscr...@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org
For additional commands, e-mail: commits-h...@cloudberry.apache.org

Reply via email to