wenjin272 commented on code in PR #974:
URL: https://github.com/apache/flink-agents/pull/974#discussion_r3740297734


##########
runtime/src/main/java/org/apache/flink/agents/runtime/actionstate/FlussActionStateStore.java:
##########
@@ -490,15 +490,32 @@ public void pruneState(Object key, long seqNum) {
 
     @Override
     public void close() throws Exception {
+        Exception firstException = null;
         try {
             if (table != null) {
                 table.close();
             }
+        } catch (Exception e) {
+            firstException = e;

Review Comment:
   Catching only `Exception` leaves the non-`Exception` cases incomplete. If 
`table.close()` throws an `Error` and `connection.close()` throws an 
`Exception`, the connection failure is assigned to `firstException` but is then 
discarded when the pending table `Error` resumes after the `finally`. 
Conversely, if `connection.close()` throws an `Error`, it bypasses the inner 
catch and still replaces the earlier table failure. Could we aggregate 
`Throwable` from both closes, keep the first as primary, add the second as 
suppressed, and rethrow the original type? The error-path test should also 
assert that the connection failure is preserved. 
`KafkaActionStateStore.close()` has the same pre-existing boundary problem: a 
producer `Error` skips `consumer.close()`, while a consumer `Error` can replace 
an earlier producer exception. That can be fixed here for consistency or 
tracked as a follow-up if it is outside this PR’s scope.



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

Reply via email to