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

NPE in OkPacket when setting auto commit

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.1.4
    • 3.3.2
    • Other
    • None
    • Database:
      AWS RDS MariaDB 10.5.21 with RDS Proxy

      Application:
      SpringBoot 2.7
      MariaDB Connector 3.1.4

      Base docker image:
      adoptopenjdk/openjdk11-openj9:jre

    Description

      We are encountering occasional NPE in production environment.

      When our spring based application starts to create transaction and set auto commit to false (which is calling `Connection.setAutoCommit()`), NPE is thrown in https://github.com/mariadb-corporation/mariadb-connector-j/blob/3.1.4/src/main/java/org/mariadb/jdbc/message/server/OkPacket.java#L52C19-L52C19

      Given line 51, `database` is possible to be null while in line 52 it's trying to invoke `database.isEmpty()`, therefore NPE is thrown.

      In addition, may I ask why calling `Connection.setAutoCommit()` can result in having `StateChange.SESSION_TRACK_SCHEMA` in the OkPacket?
      and in what situation `StateChange.SESSION_TRACK_SCHEMA` will be returned but the subsequent data will be null?

      Attachments

        Activity

          diego dupin Diego Dupin added a comment -

          Database can initially be null, but can be changed to some value. There is normally no way to changing that to null afterwhile, so implementation was designed that way. I need to identify why this case occurs first, but correction will be done whatever.

          diego dupin Diego Dupin added a comment - Database can initially be null, but can be changed to some value. There is normally no way to changing that to null afterwhile, so implementation was designed that way. I need to identify why this case occurs first, but correction will be done whatever.
          mcfung Mike Chung added a comment -

          Thanks Diego. Please let me know what I could help on troubleshooting.

          May I know if we have an expected timeline on this correction? Thanks in advance.

          mcfung Mike Chung added a comment - Thanks Diego. Please let me know what I could help on troubleshooting. May I know if we have an expected timeline on this correction? Thanks in advance.
          diego dupin Diego Dupin added a comment -

          I haven't been able to reproduce it, but i suspect this is because of RDS Proxy use.
          Anyway, correction is easily done to avoid that, and this will be part of 3.3.2

          available as 3.3.2-SNAPSHOT now (release will be during the next week):

          <repositories>
          	<repository>
          		<id>sonatype-nexus-snapshots</id>
          		<name>Sonatype Nexus Snapshots</name>
          		<url>https://oss.sonatype.org/content/repositories/snapshots</url>
          	</repository>
          </repositories>
           
          <dependencies>
          	<dependency>
          		<groupId>org.mariadb.jdbc</groupId>
          		<artifactId>mariadb-java-client</artifactId>
          		<version>3.3.2-SNAPSHOT</version>
          	</dependency>
          </dependencies>
          

          diego dupin Diego Dupin added a comment - I haven't been able to reproduce it, but i suspect this is because of RDS Proxy use. Anyway, correction is easily done to avoid that, and this will be part of 3.3.2 available as 3.3.2-SNAPSHOT now (release will be during the next week): <repositories> <repository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https: //oss.sonatype.org/content/repositories/snapshots</url> </repository> </repositories>   <dependencies> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version> 3.3 . 2 -SNAPSHOT</version> </dependency> </dependencies>

          People

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