[CONJ-1137] NPE in OkPacket when setting auto commit Created: 2023-12-08 Updated: 2023-12-11 Resolved: 2023-12-11 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 3.1.4 |
| Fix Version/s: | 3.3.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Mike Chung | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Database: Application: Base docker image: |
||
| 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? |
| Comments |
| Comment by Diego Dupin [ 2023-12-08 ] | |||||||||||||||
|
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. | |||||||||||||||
| Comment by Mike Chung [ 2023-12-08 ] | |||||||||||||||
|
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. | |||||||||||||||
| Comment by Diego Dupin [ 2023-12-11 ] | |||||||||||||||
|
I haven't been able to reproduce it, but i suspect this is because of RDS Proxy use. available as 3.3.2-SNAPSHOT now (release will be during the next week):
|