Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1885

calcite code gen make many class in perm and it cant be gc

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx!
      this is log for cluster env , i find it locked in classload and Class.forname01:
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)

      • waiting to lock <0x0000000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader)
        at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
      • locked <0x00000005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at Baz.bind(Unknown Source)
        at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331)
        at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294)
        at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553)
        at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544)
        at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193)
        at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)
        at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)

      java.lang.Thread.State: BLOCKED (on object monitor)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:348)
      at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78)
      at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254)

      • locked <0x00000005e9802818> (a org.codehaus.janino.ClassLoaderIClassLoader)

      this test case can reappear memory leak ,use it with csvtest!

      BasicDataSource dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(new Properties());

      private void checkSql(String sql, String model, Function<ResultSet, Void> fn)
      throws SQLException {
      Connection connection = null;
      Statement statement = null;
      try

      { Properties info = new Properties(); info.put("model", jsonPath(model)); dataSource.setDriverClassName(Driver.class.getName()); dataSource.setUrl("jdbc:calcite:model=" + jsonPath(model)); connection = dataSource.getConnection(); statement = connection.createStatement(); final ResultSet resultSet = statement.executeQuery( sql); fn.apply(resultSet); }

      catch (Exception e)

      { e.printStackTrace(); }

      finally

      { close(connection, statement); }

      }

      the test case:
      @Test
      public void testConcurrentQuery() throws SQLException, InterruptedException {
      final String sql = "select * \n"
      + "from long_emps ";
      final AtomicLong a = new AtomicLong(0);
      long start = System.currentTimeMillis();
      final Semaphore semaphore = new Semaphore(0);
      for (int i = 0; i < 8; i++) {

      new Thread(new Runnable() {
      int count = 0;

      @Override
      public void run() {
      while (true) {
      sql("bug", sql).checking(new Function<ResultSet, Void>() {
      public Void apply(ResultSet resultSet)

      { return null; }

      }).ok();
      semaphore.release();
      // System.out.println(Thread.currentThread().getName() + ":" + count);
      }
      }
      }).start();

      }
      semaphore.acquire(1000000);
      System.out.println(System.currentTimeMillis() - start);
      }

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              hn5092 yiming.xu
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: