tzulitai commented on a change in pull request #11335: 
[FLINK-16313][state-processor-api] Properly dispose of native resources when 
closing input split
URL: https://github.com/apache/flink/pull/11335#discussion_r388997200
 
 

 ##########
 File path: 
flink-libraries/flink-state-processing-api/src/main/java/org/apache/flink/state/api/input/operator/StateReaderOperator.java
 ##########
 @@ -104,7 +104,21 @@ public void open() throws Exception {
        }
 
        public void close() throws Exception {
-               FunctionUtils.closeFunction(function);
+               Exception exception = null;
+
+               try {
+                       FunctionUtils.closeFunction(function);
+               } catch (Exception e) {
+                       // The state backend must always be closed
+                       // to release native resources.
+                       exception = e;
+               }
+
+               keyedStateBackend.dispose();
 
 Review comment:
   how about just:
   
   ```
   try {
       FunctionUtils.closeFunction(function);
   } finally {
       keyedStateBackend.dispose();
   }
   ```
   
   ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to