Unexpected NullPointerException produced by vertx JDBC client with Oracle.
Closed this issue · 6 comments
Version
The version is 4.2.7
Context
I encountered an exception which looks suspicious in Vertx JDBC client with the Oracle database. I am using Kotlin. I am trying to retrieve data from the database, and I am using the compose function to add a sort of mapper for the data after the request succeed. The problem is, as the documentation in the compose function after preparing and excuting the query, It give an RowSet as in input and it's not impossible that it can be null. But unfortunately after a 100k or more of requests I got a null value which cause a NullPointerException: it must not be null. Cause supposedly the value of it can't be null and the distinctGuard function don't accept null value due to Kotlin null safety.
This is the code of retreiving data:
The code is simplified to debugg the issue.
Do you have a reproducer?
It's hard to create a reproducer. the issue appear only once a month after running the tests a lot of times or sending more then 100k requests.
Extra
Java version: 1.8
Kotlin: 1.5.30
Thanks for report, we'll look into it
Hey! any news about this issue?
I'm looking into it at this moment
Would you mind testing with this patch:
Index: src/main/java/io/vertx/jdbcclient/impl/ConnectionImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/io/vertx/jdbcclient/impl/ConnectionImpl.java b/src/main/java/io/vertx/jdbcclient/impl/ConnectionImpl.java
--- a/src/main/java/io/vertx/jdbcclient/impl/ConnectionImpl.java (revision 16c8c63835c4c620273af6824296f0d9d4f275e3)
+++ b/src/main/java/io/vertx/jdbcclient/impl/ConnectionImpl.java (date 1657120545948)
@@ -126,10 +126,10 @@
}
private <R> Future<Boolean> handle(JDBCQueryAction<?, R> action, QueryResultHandler<R> handler) {
- Future<JDBCResponse<R>> fut = conn.schedule(action);
- fut.onSuccess(ar -> {
- ar.handle(handler);
- });
- return fut.map(false);
+ return conn.schedule(action)
+ .map(response -> {
+ response.handle(handler);
+ return false;
+ });
}
}
Yeah I will try it just takes time to give you feedback!
@TnPoDoLsKi have you been able to try it out?