Doris-Breakwater commented on issue #70850: URL: https://github.com/apache/doris/issues/70850#issuecomment-7086413178
The source at `5f11f435e9` confirms an Arrow Flight SQL error-propagation bug. With the parallel result sink, Doris publishes one result endpoint per result BE. If a client reads a failed endpoint first, that read can send a generic cancellation to the sibling BEs and mask the execution error there. The reported client failures in 2 of 35 runs and preservation of the original error in all 32 patched runs are consistent with this race. [Parallel endpoint registration](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java#L572-L599) **Verified in source.** The local reader can get the query's stored error from `get_arrow_batch`. `ReadNext` passes it to `close`, which cleans up locally and calls `cancelFlightQuery` with the result ID alone. The FE sends `CANCELLED: Arrow Flight stream closed before EOF` to every BE in the route. A BE that processes this cancellation first can latch that reason in its query context and cancel and unregister the result buffer before the original status arrives. #70676 retains the cancellation status for later buffer lookups, so it can preserve whichever reason reached buffer removal first. [BE reader](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/be/src/service/arrow_flight/arrow_flight_batch_reader.cpp#L100-L181), [FE fan-out](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/fe/fe-core/src/main/java/org/apache/doris/arrowflight/FlightSqlQueryCancellation.java#L150-L164), [BE cancellation](https://github.com/apache/dor is/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/be/src/service/internal_service.cpp#L690-L700) **Patch review.** Please open the PR with the BE tests. Keep local cleanup and mark the reader closed when returning an authoritative query failure or cancellation from the result buffer, so later `Close` or destruction cannot send the generic FE cancellation. Preserve the existing cancellation behavior for client aborts, abandoned streams, Arrow conversion failures and transport failures. Classify by where the status came from. In particular, a remote fetch can also return a buffer-lookup error, so a blanket rule for non-OK remote responses would be too broad. A deterministic test can assert that the reader returns the injected query error and the mock FE receives zero calls through read, close and destruction. A two-BE test should verify the original error on both endpoints and cover a failure after tickets are issued. [Remote fetch handler](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/be/src/service/internal_service.cpp#L729-L750), [Existing BE cancellation tests](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/be/test/service/arrow_flight/arrow_flight_cancel_test.cpp) **Still to verify.** The ordinary Flight path can unregister the coordinator before `DoGet`, and a late fragment-status report will then bypass coordinator cancellation. Please include the exact 4.1-based FE and BE revisions, the Flight SQL driver version, and a sanitized trace for one affected query ID with the FE fragment-error time, both BEs' cancellation timestamps and reasons, and the client endpoint order and statuses. That trace and the post-ticket test should establish how the original error reaches the peer, including after coordinator unregister. [Coordinator unregister](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java#L855-L861), [Late fragment reports](https://github.com/apache/doris/blob/5f11f435e9814d5e611c7a60d8cf6bfaacf550f0/fe/fe-core/src/main/java/org/apache/doris/qe/QeProcessorImpl.java#L314-L328) Breakwater-GitHub-Analysis-Slot: slot_957aee7493cc -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
