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

NPE in MultiPrimaryReplicaClient

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 3.5.6
    • None
    • Failover
    • None

    Description

      It seems there is NPE path in code of `MultiPrimaryReplicaClient`.
      Precondition - when there was an issue with replica and

      1. `setReadOnly(true)` is called the inner state will be requestReadOnly=true, replicaClient=null, primaryClient != null
      2. when `setReadOnly(false)` is called later it will fail with NPE as replicaClient is null

      Line https://github.com/mariadb-corporation/mariadb-connector-j/blob/5222bfb7b30f8bcb71447b03d86843e872d19ec2/src/main/java/org/mariadb/jdbc/client/impl/MultiPrimaryReplicaClient.java#L294

      ```
      java.lang.NullPointerException: Cannot invoke "org.mariadb.jdbc.client.Client.getContext()" because "oldCli" is null
      at org.mariadb.jdbc.client.impl.MultiPrimaryClient.syncNewState(MultiPrimaryClient.java:299)
      at org.mariadb.jdbc.client.impl.MultiPrimaryReplicaClient.setReadOnly(MultiPrimaryReplicaClient.java:294)
      at org.mariadb.jdbc.Connection.setReadOnly(Connection.java:309)
      ```

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            phejl Petr Hejl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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