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/08/27 11:27:01 UTC

[GitHub] [flink] xintongsong opened a new pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

xintongsong opened a new pull request #13263:
URL: https://github.com/apache/flink/pull/13263


   ## What is the purpose of the change
   
   This PR fix the problem that active RMs does not close the task manager connection on worker terminated. Without this fix, RM has to wait for heartbeat timeout to find out that TM has terminated.
   
   ## Verifying this change
   
   * Add `ActiveResourceManagerTest#testCloseTaskManagerConnectionOnWorkerTerminated`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   


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



[GitHub] [flink] flinkbot edited a comment on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681892463


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922",
       "triggerID" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 990aa0f33e2fa93d40ea011082fedc6eeb37be44 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922) 
   
   <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



[GitHub] [flink] tillrohrmann commented on a change in pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
tillrohrmann commented on a change in pull request #13263:
URL: https://github.com/apache/flink/pull/13263#discussion_r478544665



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManagerTest.java
##########
@@ -307,6 +308,33 @@ public void testWorkerTerminatedNoLongerRequired() throws Exception {
 		}};
 	}
 
+	@Test
+	public void testCloseTaskManagerConnectionOnWorkerTerminated() throws Exception {
+		new Context() {{
+			final ResourceID tmResourceId = ResourceID.generate();
+			final CompletableFuture<TaskExecutorProcessSpec> requestWorkerFromDriverFuture = new CompletableFuture<>();
+			final CompletableFuture<Void> disconnectResourceManagerFuture = new CompletableFuture<>();
+
+			final TestingTaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder()
+				.setDisconnectResourceManagerConsumer((ignore) -> disconnectResourceManagerFuture.complete(null))
+				.createTestingTaskExecutorGateway();
+
+			driverBuilder.setRequestResourceFunction(taskExecutorProcessSpec -> {
+				requestWorkerFromDriverFuture.complete(taskExecutorProcessSpec);
+				return CompletableFuture.completedFuture(tmResourceId);
+			});
+
+			runTest(() -> {
+				// request a new worker, terminate it after registered
+				runInMainThread(() -> getResourceManager().startNewWorker(WORKER_RESOURCE_SPEC))
+					.thenCompose((ignrore) -> registerTaskExecutor(tmResourceId, taskExecutorGateway))

Review comment:
       ```suggestion
   					.thenCompose((ignore) -> registerTaskExecutor(tmResourceId, taskExecutorGateway))
   ```

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManager.java
##########
@@ -197,11 +197,12 @@ public void onPreviousAttemptWorkersRecovered(Collection<WorkerType> recoveredWo
 	}
 
 	@Override
-	public void onWorkerTerminated(ResourceID resourceId) {
-		log.info("Worker {} is terminated.", resourceId.getStringWithMetadata());
+	public void onWorkerTerminated(ResourceID resourceId, Exception cause) {

Review comment:
       If we don't really use `Exception cause` here, then I would suggest to simply change it into a `String diagnostics` parameter. We can later still change it if we need an `Exception` to be reported.

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManagerTest.java
##########
@@ -307,6 +308,33 @@ public void testWorkerTerminatedNoLongerRequired() throws Exception {
 		}};
 	}
 
+	@Test
+	public void testCloseTaskManagerConnectionOnWorkerTerminated() throws Exception {
+		new Context() {{
+			final ResourceID tmResourceId = ResourceID.generate();
+			final CompletableFuture<TaskExecutorProcessSpec> requestWorkerFromDriverFuture = new CompletableFuture<>();
+			final CompletableFuture<Void> disconnectResourceManagerFuture = new CompletableFuture<>();
+
+			final TestingTaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder()
+				.setDisconnectResourceManagerConsumer((ignore) -> disconnectResourceManagerFuture.complete(null))
+				.createTestingTaskExecutorGateway();
+
+			driverBuilder.setRequestResourceFunction(taskExecutorProcessSpec -> {
+				requestWorkerFromDriverFuture.complete(taskExecutorProcessSpec);
+				return CompletableFuture.completedFuture(tmResourceId);
+			});
+
+			runTest(() -> {
+				// request a new worker, terminate it after registered
+				runInMainThread(() -> getResourceManager().startNewWorker(WORKER_RESOURCE_SPEC))
+					.thenCompose((ignrore) -> registerTaskExecutor(tmResourceId, taskExecutorGateway))
+					.thenRun(() -> runInMainThread(() -> getResourceManager().onWorkerTerminated(tmResourceId, new Exception())));
+				// verify task manager connection is closed
+				disconnectResourceManagerFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS);
+			});

Review comment:
       I really like this test setup. It is very elegant :-)




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



[GitHub] [flink] flinkbot edited a comment on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681892463


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922",
       "triggerID" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4f0f42441fadc0961dbdecc9f1cf5ced660387d4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5946",
       "triggerID" : "4f0f42441fadc0961dbdecc9f1cf5ced660387d4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 990aa0f33e2fa93d40ea011082fedc6eeb37be44 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922) 
   * 4f0f42441fadc0961dbdecc9f1cf5ced660387d4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5946) 
   
   <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



[GitHub] [flink] xintongsong commented on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
xintongsong commented on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-682296119


   Thanks for the review, @tillrohrmann 


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



[GitHub] [flink] xintongsong closed pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
xintongsong closed pull request #13263:
URL: https://github.com/apache/flink/pull/13263


   


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



[GitHub] [flink] flinkbot edited a comment on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681892463


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922",
       "triggerID" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4f0f42441fadc0961dbdecc9f1cf5ced660387d4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4f0f42441fadc0961dbdecc9f1cf5ced660387d4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 990aa0f33e2fa93d40ea011082fedc6eeb37be44 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922) 
   * 4f0f42441fadc0961dbdecc9f1cf5ced660387d4 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



[GitHub] [flink] flinkbot edited a comment on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681892463


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922",
       "triggerID" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4f0f42441fadc0961dbdecc9f1cf5ced660387d4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5946",
       "triggerID" : "4f0f42441fadc0961dbdecc9f1cf5ced660387d4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4f0f42441fadc0961dbdecc9f1cf5ced660387d4 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5946) 
   
   <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



[GitHub] [flink] xintongsong commented on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
xintongsong commented on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681889571


   cc @wangyang0918 


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



[GitHub] [flink] flinkbot commented on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681892463


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 990aa0f33e2fa93d40ea011082fedc6eeb37be44 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



[GitHub] [flink] flinkbot edited a comment on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681892463


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922",
       "triggerID" : "990aa0f33e2fa93d40ea011082fedc6eeb37be44",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 990aa0f33e2fa93d40ea011082fedc6eeb37be44 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5922) 
   
   <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



[GitHub] [flink] flinkbot commented on pull request #13263: [FLINK-17273][runtime] ActiveResourceManager closes task manager connection on worker terminated.

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13263:
URL: https://github.com/apache/flink/pull/13263#issuecomment-681890615


   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 990aa0f33e2fa93d40ea011082fedc6eeb37be44 (Thu Aug 27 11:29:27 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