java.lang.ArrayIndexOutOfBoundsException: -1

Mirth Project | Wayne Huang | 2 years ago
  1. 0

    This is really strange. I was randomly getting the following exception on the batch insert queries for Oracle. I tested and verified that the old JDBC driver we were using before MIRTH-3444 does not have this problem. This does not necessarily mean that we want to revert the driver however {code} java.lang.ArrayIndexOutOfBoundsException: -1 at oracle.jdbc.driver.OraclePreparedStatement.setupDbaBindBuffers(OraclePreparedStatement.java:3528) at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:3046) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:12194) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:246) {code} This seemed to occur only when using the HikariCP connection pool at first but once I figured out what was causing it I was able to reproduce it with DBCP. There are two reasons why this is occuring. 1. We are caching prepared statements for each connection. 2. The batch and non-batch content insertion queries are using the same cached prepared statement object. It appears if for a single connection several thousand of the non-batch queries get executed with no batch query in between, then on the next batch query this exception will occur. Since the batch queries occur whenever a message is processed through the source connector, its pretty rare for a connection to have the non-batch query run several thousand times in a row without a batch query running. However it is more likely if queuing is enabled. For some reason, the way Hikari chooses which connection to return makes this issue more likely to occur with it, but ultimately the connection pool is not the cause of the problem at all. None of the other databases appear to have this problem so it may be a but with the Oracle 12 JDBC drivers. Rather than downgrade, there are two ways we can fix this issue. 1. Duplicate the insertMessageContent query in default.xml and create batchInsertMessageContent so that the batch and non-batch queries will use a different PreparedStatement object 2. Calling PreparedStatement.clearBatch before the batch also appears to fix this problem.

    Mirth Project | 2 years ago | Wayne Huang
    java.lang.ArrayIndexOutOfBoundsException: -1
  2. 0

    This is really strange. I was randomly getting the following exception on the batch insert queries for Oracle. I tested and verified that the old JDBC driver we were using before MIRTH-3444 does not have this problem. This does not necessarily mean that we want to revert the driver however {code} java.lang.ArrayIndexOutOfBoundsException: -1 at oracle.jdbc.driver.OraclePreparedStatement.setupDbaBindBuffers(OraclePreparedStatement.java:3528) at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:3046) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:12194) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:246) {code} This seemed to occur only when using the HikariCP connection pool at first but once I figured out what was causing it I was able to reproduce it with DBCP. There are two reasons why this is occuring. 1. We are caching prepared statements for each connection. 2. The batch and non-batch content insertion queries are using the same cached prepared statement object. It appears if for a single connection several thousand of the non-batch queries get executed with no batch query in between, then on the next batch query this exception will occur. Since the batch queries occur whenever a message is processed through the source connector, its pretty rare for a connection to have the non-batch query run several thousand times in a row without a batch query running. However it is more likely if queuing is enabled. For some reason, the way Hikari chooses which connection to return makes this issue more likely to occur with it, but ultimately the connection pool is not the cause of the problem at all. None of the other databases appear to have this problem so it may be a but with the Oracle 12 JDBC drivers. Rather than downgrade, there are two ways we can fix this issue. 1. Duplicate the insertMessageContent query in default.xml and create batchInsertMessageContent so that the batch and non-batch queries will use a different PreparedStatement object 2. Calling PreparedStatement.clearBatch before the batch also appears to fix this problem.

    Mirth Project | 2 years ago | Wayne Huang
    java.lang.ArrayIndexOutOfBoundsException: -1
  3. 0

    JDBC PreparedStatement, Batch Update and generated Keys

    Stack Overflow | 5 years ago | Farid
    java.lang.ArrayIndexOutOfBoundsException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to get generated keys by executeBatch without ArrayIndexOutOfBoundsException?

    Stack Overflow | 1 year ago | user2049371
    java.lang.ArrayIndexOutOfBoundsException: 22

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      -1

      at oracle.jdbc.driver.OraclePreparedStatement.setupDbaBindBuffers()
    2. Oracle jdbc
      OracleStatementWrapper.executeBatch
      1. oracle.jdbc.driver.OraclePreparedStatement.setupDbaBindBuffers(OraclePreparedStatement.java:3528)
      2. oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:3046)
      3. oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:12194)
      4. oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:246)
      4 frames