Repository navigation
Cherry pick #129193 to 26.9: Fix server abort when an Arrow Flight query throws while finishing - #129633
Conversation
DoPut, DoGet, GetSchema and executeSQLtoTables_impl (GetFlightInfo, DoAction) called BlockIO::onFinish from a SCOPE_EXIT, so on a successful call it ran in a destructor. onFinish allocates through memory-tracked containers (getProcessorsProfileLogInfo, printPipeline) and runs finish callbacks; on a normal scope exit the memory tracker is allowed to throw, so a MEMORY_LIMIT_EXCEEDED there left the destructor and called std::terminate. The stress test hit it through memory_tracker_fault_probability once it started sending queries over Arrow Flight (#125517): Stress test (arm_release), master a8e6d0b, STID 2618-2444. Call onFinish on the normal path after the work try/catch, as BlockIO::executeWithCallbacks and executeTrivialBlockIO do, and keep only onCancelOrConnectionLoss in the guard. The executors over the pipeline are locals of the try block, so they are still destroyed before onFinish releases the memory reservation their spill state points to. If onFinish throws, the guard cancels and resets the pipeline and releases the workload resources during unwinding, and the exception reaches tryRunAndLogIfError, which returns an error status to the client. The test loops all four calls in a Flight session with fault injection; the unfixed server aborts within a few dozen iterations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ry throws The previous commit called onFinish after the try block, so an exception from it reached only onCancelOrConnectionLoss in the scope guard. That path does not run the exception callbacks: with implicit_transaction = 1 in a named Flight session, the transaction begun by the query stayed in the session, and the next INSERT in that session ran inside it, skipped the implicit commit, reported success, and its rows were rolled back when the session closed. Call onFinish at the end of the try block instead, so a throw from it is handled by the existing catch and goes through onException (rollback of the implicit transaction, exception row in query_log, quota), as TCPHandler and evaluatePollDescriptor already do. Each pulling executor now lives in an inner scope, so it is still destroyed before onFinish releases the memory reservation. Measured with memory-tracker fault injection (p = 0.002) in a named session with implicit_transaction = 1, probing transactionID() after every failed call, 2500 calls per RPC: with the previous commit 312 of 2708 faults left a running transaction in the session, 250 of them onFinish faults; with this one 225 onFinish faults left none. The other leaks, 62 and 73 in the two runs, come from a fault in the BlockIO move-assignment inside executeQuery itself (QueryPlanResourceHolder::append allocates), before any handler owns the BlockIO; that is not Arrow Flight code and affects every protocol. For the same reason no transaction case is added to the test: there is no deterministic way to make onFinish throw, and under random fault injection that other path would make it flaky. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pe-exit Fix server abort when an Arrow Flight query throws while finishing
Resolve the conflicts in ArrowFlightServer.cpp: 26.9 does not have #115250, #125534 and #125553, which changed the same lines (conversion settings, the `block.empty()` check in `DoGet`, `removeSpecialColumnRepresentations`), so their changes are left out and only #129193's lines are kept. Leave out 05497_arrowflight_exception_on_query_finish: 26.9 has no Arrow Flight port in the stateless test config (#125517 is master-only), so the test cannot connect there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The conflicts are in I left out the test I cannot push to |
|
🕵 Thanks @groeneai. I reviewed your merge and pushed it to |
Original pull-request #129193
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job