Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1124

OutOfMemoryError when executeUpdate

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 3.3.0
    • 3.3.1
    • Other
    • None
    • MacOS

    Description

      The issue occurs when executing a JDBC test case using the MariaDB connector, leading to a java.lang.OutOfMemoryError: Java heap space error.
      The same test case does not produce this error when using a MySQL connector, suggesting the issue might be a potential bug in the MariaDB connector.

      @Test
      public void test1() throws SQLException {
          Connection con;
          Statement stmt;
       
          con = DriverManager.getConnection("jdbc:mariadb://localhost:3366/test1290?user=user&password=password");
          stmt = con.createStatement(1003, 1008, 2);
          stmt.addBatch("CREATE TABLE table1290_0(id BIGINT PRIMARY KEY,value VARCHAR(100));");
          stmt.executeBatch();
          stmt.close();
       
          stmt = con.prepareStatement("SELECT id FROM table1290_0 WHERE id >= ?", 1005, 1007, 2);
          stmt.setFetchSize(1604040913);
       
          ((PreparedStatement) stmt).setObject(1, "id");
          ((PreparedStatement) stmt).addBatch();
          try {
              ((PreparedStatement) stmt).executeUpdate(); // java.lang.OutOfMemoryError: Java heap space
          } catch (Exception e) {
              System.out.println(e);
          }
      }
      

      stack trace:
      java.lang.OutOfMemoryError: Java heap space

      at org.mariadb.jdbc.client.result.StreamingResult.<init>(StreamingResult.java:90)
      at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:290)
      at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:886)
      at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:825)
      at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:744)
      at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:668)
      at org.mariadb.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:91)
      at org.mariadb.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:336)
      at org.mariadb.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:313)
      at org.example.MySQL.test1(MySQL.java:36)

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            dwenking Wenqian Deng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.