github-actions[bot] commented on code in PR #69421:
URL: https://github.com/apache/doris/pull/69421#discussion_r4345561618


##########
fe/fe-core/src/main/java/org/apache/doris/arrowflight/protocol/FlightProtocolAdapter.java:
##########
@@ -588,9 +589,23 @@ public <E extends Exception> void 
runCommand(ConnectContext ctx, SessionAction<E
         });
     }
 
+    public boolean hasPendingResults() {
+        // Expiration closes Arrow buffers. Serialize cleanup with DoGet, 
which may
+        // still be sending a result obtained before its cache entry expired.
+        if (!commandLock.tryLock()) {
+            return true;
+        }
+        try {
+            return channel.hasPendingResults();
+        } finally {
+            commandLock.unlock();
+        }
+    }
+
     /** {@link #runCommand} for a command that returns a value. */
     public <T, E extends Exception> T callCommand(ConnectContext ctx, 
SessionCommand<T, E> command) throws E {
         acquireCommandLock(ctx);
+        QueryAdmissionController.INSTANCE.acquireContinuation();

Review Comment:
   [P2] Count Flight commands while they wait for the session lock
   
   A `GetTables` RPC already waiting behind `GetSessionOptions` on this session 
is invisible to shutdown until `acquireCommandLock()` returns. When the first 
command unlocks and releases its count, the drain can sample zero requests and 
its untimed `hasPendingResults()` lock attempt can overtake the waiter and see 
an empty cache. With the quiescent idle scan complete, shutdown then exits its 
wait even though the accepted metadata RPC has not run. That RPC can 
subsequently spend more than three seconds fetching uncached external-catalog 
metadata and lose its response when 
[FlightServer.close()](https://github.com/apache/arrow-java/blob/v19.0.0/flight/flight-core/src/main/java/org/apache/arrow/flight/FlightServer.java#L145-L168)
 force-closes RPCs, despite the remaining grace budget. Reserve the 
continuation before waiting for the command lock, and release it on lock 
timeout/interruption as well as normal completion. This is separate from the 
fixed CloseSession path, which bypasses this
  lock entirely.



-- 
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]

Reply via email to