You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "link3280 (via GitHub)" <gi...@apache.org> on 2023/07/21 03:58:15 UTC

[GitHub] [kyuubi] link3280 opened a new pull request, #5082: [KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

link3280 opened a new pull request, #5082:
URL: https://github.com/apache/kyuubi/pull/5082

   ### _Why are the changes needed?_
   As titled.
   
   
   ### _How was this patch tested?_
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [x] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 closed pull request #5082: [KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #5082: [KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap
URL: https://github.com/apache/kyuubi/pull/5082


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1271237907


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   IMHO, if `bootstrapJobIds == null`, the current thread would release the lock and wait for `bootstrapLock.notifyAll()` to be called by the bootstrap thread.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1270201931


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,25 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {
+      // wait in a loop to avoid spurious wakeups
+      int retry = 0;
+      while (bootstrapJobIds == null && retry < BOOTSTRAP_WAIT_RETRIES) {
+        try {
+          bootstrapLock.wait(BOOTSTRAP_WAIT_INTERVAL);
+          retry++;
+        } catch (InterruptedException e) {
+          throw new RuntimeException("Interrupted while waiting for bootstrap.", e);
+        }
+      }
+      if (bootstrapJobIds == null) {
+        throw new RuntimeException(
+            "Bootstrap of Flink SQL engine timed out after "
+                + BOOTSTRAP_WAIT_INTERVAL * BOOTSTRAP_WAIT_RETRIES
+                + ". "
+                + "Please check the engine log for more details.");

Review Comment:
   ```suggestion
                   + ". Please check the engine log for more 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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on pull request #5082: [KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#issuecomment-1646584257

   Thanks, merged to master


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1270883638


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   Emm... I'm not sure I get the idea.
   
   If the code reaches here and `bootstrapJobIds == null` is true, another thread has no opportunity to initialize the static variables since they are waiting for the `bootstrapLock` to be released.
   
   I suppose we should use a `CountDownLatch` here instead, to avoid blocking other threads to initialize the variables.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1271239951


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   This could be verified by removing this line https://github.com/apache/kyuubi/blob/bf0307565cf1196447403c6a6f8e240ac01d1cd5/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/FlinkSQLEngine.scala#L105 or add a delay like 30 seconds (which is the bootstrap timeout) to it.



##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   This could be verified by removing this line https://github.com/apache/kyuubi/blob/bf0307565cf1196447403c6a6f8e240ac01d1cd5/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/FlinkSQLEngine.scala#L105 or adding a delay like 30 seconds (which is the bootstrap timeout) to it.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1271242990


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   Sorry, my bad, the change makes sense to me



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1271237907


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   IMH, if `bootstrapJobIds == null`, the current thread would release the lock and wait for `bootstrapLock.notifyAll()` to be called by the bootstrap thread.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #5082: [KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#discussion_r1271243521


##########
externals/kyuubi-flink-sql-engine/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedExecutorFactory.java:
##########
@@ -105,6 +114,24 @@ public boolean isCompatibleWith(final Configuration configuration) {
   public PipelineExecutor getExecutor(final Configuration configuration) {
     checkNotNull(configuration);
     Collection<JobID> executorJobIDs;
+    synchronized (bootstrapLock) {

Review Comment:
   No worries. I pushed a commit to improve the logs. I think it's good to merge when the CI turns green. Thanks!



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] codecov-commenter commented on pull request #5082: [WIP][KYUUBI #5080][FLINK] Fix EmbeddedExecutorFactory not thread-safe during bootstrap

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5082:
URL: https://github.com/apache/kyuubi/pull/5082#issuecomment-1645045978

   ## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/5082?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#5082](https://app.codecov.io/gh/apache/kyuubi/pull/5082?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (fd78f32) into [master](https://app.codecov.io/gh/apache/kyuubi/commit/7631e7d8b8ca66b635f9d761c41d40e2bb73ea10?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (7631e7d) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@          Coverage Diff           @@
   ##           master   #5082   +/-   ##
   ======================================
     Coverage    0.00%   0.00%           
   ======================================
     Files         564     564           
     Lines       31311   31311           
     Branches     4098    4098           
   ======================================
     Misses      31311   31311           
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org