vertx-mqtt
vertx-mqtt copied to clipboard
exceptionHandler not used for lower level exceptions
I am running into the following issue: I am using the following simple MQTT-Verticle
public class MqttVerticle extends AbstractVerticle{
@Override
public void start() throws Exception {
Integer port = config().getInteger("mqttPort");
System.out.println("STARTING "+port);
MqttServer server = MqttServer.create(vertx);
server.exceptionHandler(e -> {
System.out.println("SERVER EXCEPTION " + port);
});
server.endpointHandler(endpoint -> {
endpoint.exceptionHandler(e -> {
System.out.println("ENDPOINT EXCEPTION "+e.toString());
});
});
server.listen(port);
}
}
I want to loadbalance using haproxy and I use the TCP-check for that. This causes logging of tons of java.io.IOException: Connection reset by peer.
None of the above exceptionHandlers is ever hit and the logs are caused by this block in ConnectionBase:
protected synchronized void handleException(Throwable t) {
this.metrics().exceptionOccurred(this.metric(), this.remoteAddress(), t);
if(this.exceptionHandler != null) {
this.exceptionHandler.handle(t);
} else {
log.error(t);
}
}
My bet would be that we need to add exceptionHandler(rejectHandler);
in MqttConnection.init.