Reputation: 31
Came across a peculiar problem with an application implemented in vertx. I have a connection pool of ~20 connections.
Once a NullPointerException is encountered in any of the request, the mysql connection stops responding.
Found below logs but could not understand why this would make the mysql connection non-responsive.
Exception in thread "vert.x-eventloop-thread-2" io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | java.lang.NullPointerException
Also, this exception comes exactly as many times as the number of connections in the connection pool after which the complete application becomes non-responsive.
Upvotes: 0
Views: 165
Reputation: 556
From documentation
"when calling the Subscribe method that only has an onNext argument, the OnError behavior will be to rethrow the exception on the thread that the message comes out from the observable sequence. The OnCompleted behavior in this case is to do nothing."
It looks like you need to handle the exception, letting the program know what to do when an exception (In this case NPE) occurs. So adding an onError()
implementation to your .subscribe()
(or stream) will be great.
This other stack overflow answer may be of help.
Upvotes: 1