Server Memory Leak When Using Connection Cache And Queries On XMLType Objects. (Doc ID 557989.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version: 10.1.0.4 to 11.1
This problem can occur on any platform.

Symptoms

Find that running a query "select sys_xmlgen(1) from dual" from a java program using a JDBC driver with the connection cache enabled,  results in the database process consuming more and more memory for every iteration until it crashed .

Your java code looks like:


      ...
      OracleDataSource ods = new OracleDataSource();
      ods.setURL("jdbc:oracle:thin:@" + url );
      ods.setUser("tester");
      ods.setPassword("tester");
      ods.setConnectionCachingEnabled(true);

      // Retrieve connection.
      Connection conn = ods.getConnection(); 

      // Iterate to show database memory increasing.
      int i = 0;
      boolean b = true;
      while (b)
      {
        i++;
        conn = ods.getConnection(); 

        String sql = "select sys_xmlgen(1) from dual "; 

        OracleCallableStatement st = (OracleCallableStatement)conn.prepareCall(sql);
        ResultSet results = st.executeQuery();

        int rowCount = 0;
        while (results.next())
        {
          rowCount++;
        } 

        results.close();
        st.close();
        conn.close();

      }
      ...

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms