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

Intermittent NullPointerException in prepareStatement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.7.13
    • aurora, Failover
    • None
    • Amazon Linux
      Java 8
      Groovy 2.5.2

    Description

      I believe the fix for this issue is likely similar to these two commits that were made for CONJ-616:

      We are connecting to an AWS Aurora RDS datasource using a connection string that looks like this:
      jdbc:mariadb:aurora://XXXXX.cluster-XXXXX.us-east-1.rds.amazonaws.com:3306/XXXXX?socketTimeout=0&useSSL=true&connectTimeout=31000

      After connecting successfully, we are occasionally getting this NullPointerException on calls to prepareStatement:

      java.lang.NullPointerException: null
            at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.noBackslashEscapes(MastersSlavesListener.java:294)
            at org.mariadb.jdbc.internal.failover.FailoverProxy.invoke(FailoverProxy.java:158)
            at com.sun.proxy.$Proxy18.noBackslashEscapes(Unknown Source)
            at org.mariadb.jdbc.MariaDbConnection.internalPrepareStatement(MariaDbConnection.java:535)
            at org.mariadb.jdbc.MariaDbConnection.prepareStatement(MariaDbConnection.java:350)
            at groovy.sql.Sql$CreatePreparedStatementCommand.execute(Sql.java:4604)
            at groovy.sql.Sql$CreatePreparedStatementCommand.execute(Sql.java:4582)
            at groovy.sql.Sql.getAbstractStatement(Sql.java:4421)
            at groovy.sql.Sql.getPreparedStatement(Sql.java:4436)
            at groovy.sql.Sql.getPreparedStatement(Sql.java:4525)
            at groovy.sql.Sql.eachRow(Sql.java:1282)
            at groovy.sql.Sql.eachRow(Sql.java:1376)
            at groovy.sql.Sql.eachRow(Sql.java:1435)
            at groovy.sql.Sql$eachRow.call(Unknown Source)
      

      In this instance, our input into Groovy's eachRow method was:
      sql: "SELECT table_name FROM information_schema.tables where table_schema=current_database() and lower(table_name)=?"
      params: ["connection_data"]
      closure: irrelevant, we weren't getting far enough into execution for the code to hit this parameter

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            joseph.witthuhn Joseph Witthuhn
            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.