You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "1996fanrui (via GitHub)" <gi...@apache.org> on 2023/06/29 06:43:24 UTC

[GitHub] [flink] 1996fanrui opened a new pull request, #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

1996fanrui opened a new pull request, #22900:
URL: https://github.com/apache/flink/pull/22900

   ## What is the purpose of the change
   
   SourceCoordinatorAlignmentTest.testAnnounceCombinedWatermarkWithoutStart fails
   
   Root cause: multiple sources share the same thread pool, and the second source cannot start due to the first source closes the shared thread pool.
   
   ## Brief change log
   
   Create new thread pool for each SourceCoordinatorContext.
   
   
   ## Verifying this change
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   ## 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, ZooKeeper:  no
     - The S3 file system connector:no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] pnowojski commented on a diff in pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "pnowojski (via GitHub)" <gi...@apache.org>.
pnowojski commented on code in PR #22900:
URL: https://github.com/apache/flink/pull/22900#discussion_r1246351087


##########
flink-runtime/src/test/java/org/apache/flink/runtime/source/coordinator/SourceCoordinatorTestBase.java:
##########
@@ -215,7 +211,7 @@ Source<Integer, MockSourceSplit, Set<MockSourceSplit>> createMockSource() {
 
     protected SourceCoordinatorContext<MockSourceSplit> getNewSourceCoordinatorContext() {
         return new SourceCoordinatorContext<>(
-                coordinatorExecutor,
+                Executors.newScheduledThreadPool(1, coordinatorThreadFactory),
                 Executors.newScheduledThreadPool(
                         1,
                         new ExecutorThreadFactory(

Review Comment:
   Can you check that each created coordinator is actually properly closed? I think there are places (I haven't checked everything) like: (...)
   ```
   SourceCoordinatorTest#testSerdeBackwardCompatibility
   SourceCoordinatorConcurrentAttemptsTest#testCoordinatorThrowExceptionIfWatermarkAlignmentIsEnabled
   ```
   (...) where this is not true, and your change would cause a thread leak?
   
   Maybe instead of fixing each place individually, we can drop `sourceCoordinator.close()` from `@AfterEach` method above, and just create a `CloseableRegistry`, where this method `getNewSourceCoordinatorContext` would register every newly created registry and we could clean reigstry in `@AfterEach`?
   
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui commented on pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on PR #22900:
URL: https://github.com/apache/flink/pull/22900#issuecomment-1613239588

   Thanks for the review, merging


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] pnowojski commented on pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "pnowojski (via GitHub)" <gi...@apache.org>.
pnowojski commented on PR #22900:
URL: https://github.com/apache/flink/pull/22900#issuecomment-1612680671

   LGTM % fixing closing issue. Feel free to merge it after it's fixed :)


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #22900:
URL: https://github.com/apache/flink/pull/22900#issuecomment-1612515856

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "46be6d6adabb920baa0de80403cea863f0adc0c6",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "46be6d6adabb920baa0de80403cea863f0adc0c6",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 46be6d6adabb920baa0de80403cea863f0adc0c6 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] pnowojski commented on a diff in pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "pnowojski (via GitHub)" <gi...@apache.org>.
pnowojski commented on code in PR #22900:
URL: https://github.com/apache/flink/pull/22900#discussion_r1246351087


##########
flink-runtime/src/test/java/org/apache/flink/runtime/source/coordinator/SourceCoordinatorTestBase.java:
##########
@@ -215,7 +211,7 @@ Source<Integer, MockSourceSplit, Set<MockSourceSplit>> createMockSource() {
 
     protected SourceCoordinatorContext<MockSourceSplit> getNewSourceCoordinatorContext() {
         return new SourceCoordinatorContext<>(
-                coordinatorExecutor,
+                Executors.newScheduledThreadPool(1, coordinatorThreadFactory),
                 Executors.newScheduledThreadPool(
                         1,
                         new ExecutorThreadFactory(

Review Comment:
   Can you check that each created coordinator is actually properly closed? I think there are places:
   org.apache.flink.runtime.source.coordinator.SourceCoordinatorTest#testSerdeBackwardCompatibility
   org.apache.flink.runtime.source.coordinator.SourceCoordinatorConcurrentAttemptsTest#testCoordinatorThrowExceptionIfWatermarkAlignmentIsEnabled
   
   Where this is not true, and your change would cause a thread leak? Maybe instead of fixing each place individually, we can drop `sourceCoordinator.close()` from `@AfterEach` method above, and just create a `CloseableRegistry`, where this method `getNewSourceCoordinatorContext` would register every newly created registry and we could clean reigstry in `@AfterEach`?
   
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] pnowojski commented on a diff in pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "pnowojski (via GitHub)" <gi...@apache.org>.
pnowojski commented on code in PR #22900:
URL: https://github.com/apache/flink/pull/22900#discussion_r1246351087


##########
flink-runtime/src/test/java/org/apache/flink/runtime/source/coordinator/SourceCoordinatorTestBase.java:
##########
@@ -215,7 +211,7 @@ Source<Integer, MockSourceSplit, Set<MockSourceSplit>> createMockSource() {
 
     protected SourceCoordinatorContext<MockSourceSplit> getNewSourceCoordinatorContext() {
         return new SourceCoordinatorContext<>(
-                coordinatorExecutor,
+                Executors.newScheduledThreadPool(1, coordinatorThreadFactory),
                 Executors.newScheduledThreadPool(
                         1,
                         new ExecutorThreadFactory(

Review Comment:
   Can you check that each created coordinator is actually properly closed? I think there are places:
   `SourceCoordinatorTest#testSerdeBackwardCompatibility`
   `SourceCoordinatorConcurrentAttemptsTest#testCoordinatorThrowExceptionIfWatermarkAlignmentIsEnabled`
   
   Where this is not true, and your change would cause a thread leak? Maybe instead of fixing each place individually, we can drop `sourceCoordinator.close()` from `@AfterEach` method above, and just create a `CloseableRegistry`, where this method `getNewSourceCoordinatorContext` would register every newly created registry and we could clean reigstry in `@AfterEach`?
   
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui commented on a diff in pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #22900:
URL: https://github.com/apache/flink/pull/22900#discussion_r1246374609


##########
flink-runtime/src/test/java/org/apache/flink/runtime/source/coordinator/SourceCoordinatorTestBase.java:
##########
@@ -215,7 +211,7 @@ Source<Integer, MockSourceSplit, Set<MockSourceSplit>> createMockSource() {
 
     protected SourceCoordinatorContext<MockSourceSplit> getNewSourceCoordinatorContext() {
         return new SourceCoordinatorContext<>(
-                coordinatorExecutor,
+                Executors.newScheduledThreadPool(1, coordinatorThreadFactory),
                 Executors.newScheduledThreadPool(
                         1,
                         new ExecutorThreadFactory(

Review Comment:
   Thanks for the review!
   
   Good catch! updated.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui commented on pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on PR #22900:
URL: https://github.com/apache/flink/pull/22900#issuecomment-1612522262

   Hi @pnowojski @RocMarshal , would you mind take a look this PR of FLINK-32478? All of Flink master, release-1.16 and release-1.17 have this bug, sorry for causing this problem. 
   
   The multiple sources of `SourceCoordinatorAlignmentTest.testAnnounceCombinedWatermarkWithoutStart` share the same thread pool, and the second source cannot start due to the first source closes the shared thread pool.
   
   I didn't rebase master at #22845 , so I didn't find this project before merging. I'll pay more attention in the future.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] pnowojski commented on a diff in pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "pnowojski (via GitHub)" <gi...@apache.org>.
pnowojski commented on code in PR #22900:
URL: https://github.com/apache/flink/pull/22900#discussion_r1246351087


##########
flink-runtime/src/test/java/org/apache/flink/runtime/source/coordinator/SourceCoordinatorTestBase.java:
##########
@@ -215,7 +211,7 @@ Source<Integer, MockSourceSplit, Set<MockSourceSplit>> createMockSource() {
 
     protected SourceCoordinatorContext<MockSourceSplit> getNewSourceCoordinatorContext() {
         return new SourceCoordinatorContext<>(
-                coordinatorExecutor,
+                Executors.newScheduledThreadPool(1, coordinatorThreadFactory),
                 Executors.newScheduledThreadPool(
                         1,
                         new ExecutorThreadFactory(

Review Comment:
   Can you check that each created coordinator is actually properly closed? I think there are places like:
   ```
   SourceCoordinatorTest#testSerdeBackwardCompatibility
   SourceCoordinatorConcurrentAttemptsTest#testCoordinatorThrowExceptionIfWatermarkAlignmentIsEnabled
   ```
   (I haven't checked everything)
   
   Where this is not true, and your change would cause a thread leak? Maybe instead of fixing each place individually, we can drop `sourceCoordinator.close()` from `@AfterEach` method above, and just create a `CloseableRegistry`, where this method `getNewSourceCoordinatorContext` would register every newly created registry and we could clean reigstry in `@AfterEach`?
   
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui merged pull request #22900: [FLINK-32478][connectors/common] Fix the bug that the shared thread pool causes the source alignment unit test to fail

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui merged PR #22900:
URL: https://github.com/apache/flink/pull/22900


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org