[CONJ-775] Null Pointer Exception when attempting to close an invalid connection Created: 2020-03-24 Updated: 2020-04-02 Resolved: 2020-04-02 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | configuration |
| Affects Version/s: | 2.6.0 |
| Fix Version/s: | 2.6.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Willis Wendler | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | crash | ||
| Environment: |
Red Hat Enterprise Linux release 8.1 (Ootpa) |
||
| Description |
|
I'm in the process of upgrading from MariaDB 5.5.56 to 10.3.17. As part of this I went from using mysql-connector-java version 5.1.35 to using mariadb-connector-java version 2.6.0. One of my java applications is now crashing at start up (the others are working with this setup). I've attached a stack trace and an approximate version of what my code is doing. Looking at the mariaDB Connector/J code I see that AbstractConnectProtocol is calling SendClosePacket.send with a null PacketOutputStream. I'm not sure where the exact problem is but I think MariaDB Connector should at least be throwing a better exception.
|
| Comments |
| Comment by Diego Dupin [ 2020-03-25 ] | |
|
NPE should of course never occur. Reading code, the only possibility i found that could cause this is having a badly formed url connection like "jdbc:mariadb:///test" with 3 slashes.
having 3 slashes means that there is no host. This is permitted, because of windows named pipe that will use option `pipe` then. But there is no test to ensure pipe is set if there is no host. Could you confirm that this could correspond to your configuration ? | |
| Comment by Willis Wendler [ 2020-03-25 ] | |
|
You're exactly right Diego! I was trying to connect to jdbc:mysql:///DBname essentially. Apparently the old mysql connector accepted the malformed url when connecting to a mariadb server running on localhost. The application works once I change the url it connects to. | |
| Comment by Diego Dupin [ 2020-04-02 ] | |
|
commit to avoid repeating this: https://github.com/mariadb-corporation/mariadb-connector-j/commit/ab2e8dbc9a91ce768b02198bfcdc6ec5017bcd65 |