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

Ensure not having NPE after reconnection fail for high availability configurations

    XMLWordPrintable

Details

    Description

      When using High Availability mode (e.g., loadbalance, replication), the system automatically attempts to reconnect when an existing connection fails. However, a problem occurs when this reconnection attempt fails.

      Specific Problem

      After a failed reconnection, the connection enters an invalid state where connection.rollback() or connection.commit() operations throw a NullPointerException:

      java.lang.NullPointerException: Cannot invoke "org.mariadb.jdbc.client.Client.getContext()" because "this.currentClient" is null
      

      Expected Behavior

      When a connection throws an SQLNonTransientConnectionException, the connection should no longer be usable. Any command must now throw an SQLException.

      For example connection pools (like Apache Pool) might still attempt to perform rollback operations on these invalid connections silently catching the SQLException if there is any issue. This is a problem because in this state, connector would throw an SQLException, but in our case, it throw an NPE.

      Required Fix

      The connector must ensure that any command execution after failing reconnection either:

      Succeeds completely, or
      Throws a proper SQLException

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            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.