You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/03/06 15:54:36 UTC

[GitHub] [flink] sjwiesman opened a new pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

sjwiesman opened a new 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
 
 
   ## What is the purpose of the change
   
   FLINK-15014 refactored the `KeyedStateInputFormat` to be more composable. The change did not properly account for the new ownership of the `StateBackend` object and did not dispose of native resources. 
   
   This fix needs to be backported to 1.10
   
   ## Verifying this change
   
   This change is already covered by existing tests.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / **not documented**)
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] tzulitai commented on a change in pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] sjwiesman commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
sjwiesman commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split
URL: https://github.com/apache/flink/pull/11335#issuecomment-595832273
 
 
   cc @rmetzger 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] asfgit closed pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
asfgit closed 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
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] sjwiesman commented on a change in pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
sjwiesman 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_r388998696
 
 

 ##########
 File path: flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/RocksDBStateBackendReaderKeyedStateITCase.java
 ##########
 @@ -22,12 +22,9 @@
 import org.apache.flink.runtime.state.StateBackend;
 import org.apache.flink.runtime.state.memory.MemoryStateBackend;
 
-import org.junit.Ignore;
-
 /**
  * IT Case for reading state from a RocksDB keyed state backend.
  */
-@Ignore
 
 Review comment:
   @rmetzger disabled that test yesterday so that travis would not spuriously fail other PRs. I'm re-enabling the test as part of the fix. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
flinkbot commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split
URL: https://github.com/apache/flink/pull/11335#issuecomment-595841353
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b42d044c774fe3b4916def39a67407133826ccd0",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b42d044c774fe3b4916def39a67407133826ccd0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b42d044c774fe3b4916def39a67407133826ccd0 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] tzulitai commented on a change in pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
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_r388998971
 
 

 ##########
 File path: flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/RocksDBStateBackendReaderKeyedStateITCase.java
 ##########
 @@ -22,12 +22,9 @@
 import org.apache.flink.runtime.state.StateBackend;
 import org.apache.flink.runtime.state.memory.MemoryStateBackend;
 
-import org.junit.Ignore;
-
 /**
  * IT Case for reading state from a RocksDB keyed state backend.
  */
-@Ignore
 
 Review comment:
   Ah, just saw the discussions in the JIRA. Got it, seems like a revert of temporary ignore.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] sjwiesman commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
sjwiesman commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split
URL: https://github.com/apache/flink/pull/11335#issuecomment-595833731
 
 
   cc @tzulitai 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] tzulitai commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
tzulitai commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split
URL: https://github.com/apache/flink/pull/11335#issuecomment-595849326
 
 
   +1, LGTM.
   
   I've locally verified that the `state-processor-api` does indeed fail with the test ignored but fix not applied, and the tests no longer fail after applying the patch.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] tzulitai commented on a change in pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
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_r388996407
 
 

 ##########
 File path: flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/RocksDBStateBackendReaderKeyedStateITCase.java
 ##########
 @@ -22,12 +22,9 @@
 import org.apache.flink.runtime.state.StateBackend;
 import org.apache.flink.runtime.state.memory.MemoryStateBackend;
 
-import org.junit.Ignore;
-
 /**
  * IT Case for reading state from a RocksDB keyed state backend.
  */
-@Ignore
 
 Review comment:
   How is this test related to the change?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split
URL: https://github.com/apache/flink/pull/11335#issuecomment-595841353
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b42d044c774fe3b4916def39a67407133826ccd0",
       "status" : "PENDING",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/152177398",
       "triggerID" : "b42d044c774fe3b4916def39a67407133826ccd0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b42d044c774fe3b4916def39a67407133826ccd0 Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/152177398) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
flinkbot commented on issue #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split
URL: https://github.com/apache/flink/pull/11335#issuecomment-595833402
 
 
   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 353b3fb1e715d9adce936a2e862503eb62ae6ce4 (Fri Mar 06 15:57:37 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] sjwiesman commented on a change in pull request #11335: [FLINK-16313][state-processor-api] Properly dispose of native resources when closing input split

Posted by GitBox <gi...@apache.org>.
sjwiesman 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_r388999026
 
 

 ##########
 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:
   -1 `keyedStateBackend.dispose()` throws and exception and checkstyle did not like calling a method that throws inside of a `finally` block. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services