You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/07/25 08:58:36 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #3121] [CI] Fix GA oom issue

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e9101979 [KYUUBI #3121] [CI] Fix GA oom issue
0e9101979 is described below

commit 0e910197946968901c0e488abd2bd742121c3b67
Author: Fu Chen <cf...@gmail.com>
AuthorDate: Mon Jul 25 16:58:26 2022 +0800

    [KYUUBI #3121] [CI] Fix GA oom issue
    
    ### _Why are the changes needed?_
    
    This PR aims to fix the OOM issue that happened on Github Action
    
    ### _How was this patch tested?_
    
    Pass CI.
    
    Closes #3121 from cfmcgrady/fix-ga-oom.
    
    Closes #3121
    
    48138494 [Fu Chen] engine_name length
    22b2323e [Fu Chen] address comment
    ffed26ff [Fu Chen] enabled rest frontend
    a6df03ea [Fu Chen] fix ga oom issue
    
    Authored-by: Fu Chen <cf...@gmail.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../test/spark/SparkOnKubernetesTestsSuite.scala    |  1 +
 .../sql/derby/metadata-store-schema-derby.sql       |  2 +-
 .../sql/mysql/metadata-store-schema-mysql.sql       |  2 +-
 .../scala/org/apache/kyuubi/WithKyuubiServer.scala  | 21 ++++++++++++++++++++-
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala b/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala
index 42d65741c..604a0f0b7 100644
--- a/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala
+++ b/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala
@@ -52,6 +52,7 @@ abstract class SparkOnKubernetesSuiteBase
       .set("spark.kubernetes.driver.request.cores", "250m")
       .set("spark.kubernetes.executor.request.cores", "250m")
       .set("kyuubi.kubernetes.context", "minikube")
+      .set("kyuubi.frontend.protocols", "THRIFT_BINARY,REST")
   }
 }
 
diff --git a/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql b/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql
index a4311fede..ecf41d6ab 100644
--- a/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql
+++ b/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql
@@ -18,7 +18,7 @@ CREATE TABLE metadata(
     engine_type varchar(1024) NOT NULL, -- the engine type
     cluster_manager varchar(128), -- the engine cluster manager
     engine_id varchar(128), -- the engine application id
-    engine_name varchar(1024), -- the engine application name
+    engine_name clob, -- the engine application name
     engine_url varchar(1024), -- the engine tracking url
     engine_state varchar(128), -- the engine application state
     engine_error clob, -- the engine application diagnose
diff --git a/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql b/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql
index ef8218191..4efddaa92 100644
--- a/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql
+++ b/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql
@@ -18,7 +18,7 @@ CREATE TABLE metadata(
     engine_type varchar(1024) NOT NULL COMMENT 'the engine type',
     cluster_manager varchar(128) COMMENT 'the engine cluster manager',
     engine_id varchar(128) COMMENT 'the engine application id',
-    engine_name varchar(1024) COMMENT 'the engine application name',
+    engine_name mediumtext COMMENT 'the engine application name',
     engine_url varchar(1024) COMMENT 'the engine tracking url',
     engine_state varchar(128) COMMENT 'the engine application state',
     engine_error mediumtext COMMENT 'the engine application diagnose',
diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/WithKyuubiServer.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/WithKyuubiServer.scala
index d15f051b7..b54992ef1 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/WithKyuubiServer.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/WithKyuubiServer.scala
@@ -17,12 +17,16 @@
 
 package org.apache.kyuubi
 
+import scala.util.control.NonFatal
+
 import org.apache.kyuubi.config.KyuubiConf
 import org.apache.kyuubi.config.KyuubiConf._
 import org.apache.kyuubi.config.KyuubiConf.FrontendProtocols.FrontendProtocol
 import org.apache.kyuubi.ha.HighAvailabilityConf.{HA_ADDRESSES, HA_ZK_AUTH_TYPE}
 import org.apache.kyuubi.ha.client.AuthTypes
 import org.apache.kyuubi.server.KyuubiServer
+import org.apache.kyuubi.service.AbstractFrontendService
+import org.apache.kyuubi.session.KyuubiSessionManager
 import org.apache.kyuubi.zookeeper.{EmbeddedZookeeper, ZookeeperConf}
 
 trait WithKyuubiServer extends KyuubiFunSuite {
@@ -36,7 +40,7 @@ trait WithKyuubiServer extends KyuubiFunSuite {
   protected var server: KyuubiServer = _
 
   override def beforeAll(): Unit = {
-    conf.set(FRONTEND_PROTOCOLS, frontendProtocols.map(_.toString))
+    conf.setIfMissing(FRONTEND_PROTOCOLS, frontendProtocols.map(_.toString))
     conf.set(FRONTEND_THRIFT_BINARY_BIND_PORT, 0)
     conf.set(FRONTEND_REST_BIND_PORT, 0)
     conf.set(FRONTEND_MYSQL_BIND_PORT, 0)
@@ -52,6 +56,7 @@ trait WithKyuubiServer extends KyuubiFunSuite {
 
     conf.set("spark.ui.enabled", "false")
     conf.setIfMissing("spark.sql.catalogImplementation", "in-memory")
+    conf.setIfMissing("kyuubi.ha.zookeeper.connection.retry.policy", "ONE_TIME")
     conf.setIfMissing(ENGINE_CHECK_INTERVAL, 1000L)
     conf.setIfMissing(ENGINE_IDLE_TIMEOUT, 5000L)
     server = KyuubiServer.startServer(conf)
@@ -59,6 +64,20 @@ trait WithKyuubiServer extends KyuubiFunSuite {
   }
 
   override def afterAll(): Unit = {
+    server.frontendServices.foreach {
+      case frontend: AbstractFrontendService =>
+        val sessionManager = frontend.be.sessionManager.asInstanceOf[KyuubiSessionManager]
+        sessionManager.allSessions().foreach { session =>
+          logger.warn(s"found unclosed session ${session.handle}.")
+          try {
+            sessionManager.closeSession(session.handle)
+          } catch {
+            case NonFatal(e) =>
+              logger.warn(s"catching an error while closing the session ${session.handle}", e)
+          }
+        }
+      case _ =>
+    }
 
     if (server != null) {
       server.stop()