This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 04c3a97a912 branch-4.1: [fix](arrow-flight) Harden split source error 
path to avoid BE crash on external table scan #64797 (#64890)
04c3a97a912 is described below

commit 04c3a97a9127ef28e3ae458c6a869d8c970f9879
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jun 26 20:50:01 2026 +0800

    branch-4.1: [fix](arrow-flight) Harden split source error path to avoid BE 
crash on external table scan #64797 (#64890)
    
    Cherry-picked from #64797
    
    Co-authored-by: Mingyu Chen (Rayner) <[email protected]>
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
---
 be/src/exec/scan/split_source_connector.cpp                  |  4 +++-
 be/src/format/arrow/arrow_utils.cpp                          | 12 +++++++++++-
 .../java/org/apache/doris/service/FrontendServiceImpl.java   | 10 +++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/be/src/exec/scan/split_source_connector.cpp 
b/be/src/exec/scan/split_source_connector.cpp
index 81748261d98..685a2d50f0c 100644
--- a/be/src/exec/scan/split_source_connector.cpp
+++ b/be/src/exec/scan/split_source_connector.cpp
@@ -59,7 +59,9 @@ Status RemoteSplitSourceConnector::get_next(bool* has_next, 
TFileRangeDesc* rang
             coord->fetchSplitBatch(result, request);
             if (result.__isset.status && result.status.status_code != 
TStatusCode::OK) {
                 return Status::IOError<false>("Failed to get batch of split 
source: {}",
-                                              result.status.error_msgs[0]);
+                                              result.status.error_msgs.empty()
+                                                      ? "unknown error"
+                                                      : 
result.status.error_msgs[0]);
             }
         } catch (std::exception& e) {
             return Status::IOError<false>("Failed to get batch of split 
source: {}", e.what());
diff --git a/be/src/format/arrow/arrow_utils.cpp 
b/be/src/format/arrow/arrow_utils.cpp
index 724af28be39..d9c29eceed0 100644
--- a/be/src/format/arrow/arrow_utils.cpp
+++ b/be/src/format/arrow/arrow_utils.cpp
@@ -38,7 +38,17 @@ arrow::Status to_arrow_status(const Status& status) {
         // The length of exception msg returned to the ADBC Client cannot 
larger than 8192,
         // otherwise ADBC Client will receive:
         // `INTERNAL: http2 exception Header size exceeded max allowed size 
(8192)`.
-        return arrow::Status::Invalid(status.to_string_no_stack());
+        // The message is carried in the gRPC trailer (an HTTP2 header) and 
may be
+        // percent-encoded (which can expand its size), so an oversized 
message can break the
+        // response or even crash the flight transport status conversion. 
Truncate it well below
+        // 8192 to leave headroom; the full message is already logged above.
+        constexpr size_t kMaxArrowStatusMsgLen = 1024;
+        std::string msg = status.to_string_no_stack();
+        if (msg.size() > kMaxArrowStatusMsgLen) {
+            msg.resize(kMaxArrowStatusMsgLen);
+            msg += "... (truncated)";
+        }
+        return arrow::Status::Invalid(msg);
     }
 }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 7441113ad56..f0d70434183 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -1023,7 +1023,15 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
         SplitSource splitSource =
                 
Env.getCurrentEnv().getSplitSourceManager().getSplitSource(request.getSplitSourceId());
         if (splitSource == null) {
-            throw new TException("Split source " + request.getSplitSourceId() 
+ " is released");
+            // Return a structured error status instead of throwing a bare 
TException, so the BE
+            // receives a well-formed error (with a non-empty message) through 
the normal result
+            // path. Throwing here surfaces as a thrift transport exception on 
the BE side and,
+            // on the Arrow Flight path, may feed an empty/invalid error 
string into the gRPC
+            // status conversion. See 
https://github.com/apache/doris/issues/62259
+            LOG.warn("split source {} is released", 
request.getSplitSourceId());
+            result.status = new TStatus(TStatusCode.NOT_FOUND);
+            result.status.addToErrorMsgs("Split source " + 
request.getSplitSourceId() + " is released");
+            return result;
         }
         try {
             List<TScanRangeLocations> locations = 
splitSource.getNextBatch(request.getMaxNumSplits());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to