You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "turboFei (via GitHub)" <gi...@apache.org> on 2023/05/13 09:37:42 UTC

[GitHub] [kyuubi] turboFei opened a new pull request, #4837: Refactor code to prevent exception leak in operation that makes operations always pending

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

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
     2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### _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
   
   - [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/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] turboFei commented on pull request #4837: Fix operation exception leak issue

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

   close it, it is too difficult


-- 
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] turboFei commented on a diff in pull request #4837: Refactor code to prevent exception leak in operation that makes operations always pending

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


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala:
##########
@@ -165,10 +165,34 @@ abstract class AbstractOperation(session: Session) extends Operation with Loggin
 
   protected def afterRun(): Unit
 
+  protected def onError(): PartialFunction[Throwable, Unit]
+
+  protected def submitInBackground(r: Runnable): Future[_] = {
+    val onErrorRunnable = new Runnable {
+      override def run(): Unit =
+        try {
+          r.run()
+        } catch onError()
+    }
+    try {
+      session.sessionManager.submitBackgroundOperation(onErrorRunnable)
+    } catch {
+      case e: RejectedExecutionException =>
+        throw new KyuubiException(s"Error submitting $opType in background, request rejected", e)
+    }
+  }
+
   override def run(): Unit = {
-    beforeRun()
+    try {
+      beforeRun()
+    } catch {
+      onError()
+    }
+
     try {
       runInternal()
+    } catch {
+      onError()

Review Comment:
   the main change is in this class



-- 
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] turboFei closed pull request #4837: Fix operation exception leak issue

Posted by "turboFei (via GitHub)" <gi...@apache.org>.
turboFei closed pull request #4837: Fix operation exception leak issue
URL: https://github.com/apache/kyuubi/pull/4837


-- 
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] turboFei commented on pull request #4837: Refactor code to prevent exception leak in operation that makes operations stuck

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

   cc @cfmcgrady @cxzl25 @pan3793 @bowenliang123  


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