paho.mqtt.java icon indicating copy to clipboard operation
paho.mqtt.java copied to clipboard

validateQos() Crash

Open ishaansrm opened this issue 7 years ago • 15 comments

Please fill out the form below before submitting, thank you!

  • [x ] Bug exists Release Version 1.1.1 ( Master Branch)
  • [ ] Bug exists in Snapshot Version 1.1.2-SNAPSHOT (Develop Branch)

This is the stacktrace:

Fatal Exception: java.lang.IllegalArgumentException
       at org.eclipse.paho.client.mqttv3.MqttMessage.validateQos(MqttMessage.java:41)
       at org.eclipse.paho.client.mqttv3.MqttMessage.setQos(MqttMessage.java:181)
       at org.eclipse.paho.client.mqttv3.internal.wire.MqttPublish.(MqttPublish.java)
       at org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage.createWireMessage(MqttWireMessage.java:193)
       at org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage.createWireMessage(MqttWireMessage.java:167)
       at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:119)
       at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:116)
       at java.lang.Thread.run(Thread.java:841)

I understand that validateQos() is receiving an invalid QOS, but is the client trying to publish that invalid QOS message or is it received on the client in a malformed way from the broker?

As per my understanding of this stack trace, the client received a msg which it failed to convert into a valid MqttMessage due to an invalid QOS. Is that right? It's a confusing stacktrace :(

ishaansrm avatar Aug 03 '17 13:08 ishaansrm

Facing the same issue.

IanWambai avatar Sep 07 '17 07:09 IanWambai

@ishaansrm & @IanWambai What type of MQTT Server are you using?

jpwsutton avatar Sep 07 '17 08:09 jpwsutton

Mosquitto broker

ishaansrm avatar Sep 07 '17 10:09 ishaansrm

Same.

IanWambai avatar Sep 07 '17 10:09 IanWambai

@jpwsutton were you able to figure out what's causing the issue?

IanWambai avatar Sep 25 '17 08:09 IanWambai

@IanWambai Sadly not as I cannot re-create this issue myself. Could you enable logging following the instructions here and show us the log messages that appear with this exception please?

jpwsutton avatar Sep 25 '17 09:09 jpwsutton

Will enable logging too. Please note that I've been able to see the issue only in production, never on my test bed.

ishaansrm avatar Sep 25 '17 09:09 ishaansrm

Is it possible to enable logging in production java (android) apps? If yes then how? As per my understanding we need to push the props file to java client but that's be difficult to do for production clients.

This crash is only seen in production.

ishaangarg avatar Mar 06 '18 12:03 ishaangarg

You would need to modify the launch command to include the -Djava.util.logging.config.file=/path/to/logging/file, that's the only requirement.

jpwsutton avatar Mar 26 '18 13:03 jpwsutton

Hi, have u fixed this bug?

chris-lg avatar Jan 22 '19 01:01 chris-lg

I have the same issue. I received this exception log without a clear cause. As this can't be caught outside of the library's code, I propose catching this internally.

DavyHubrecht avatar May 27 '20 14:05 DavyHubrecht

For me this issue was because of wrong server address/port as serverURI in new MqttClient(...). As you can see at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:116) ~ feels like message incoming decode fails.

strautins avatar Jul 22 '20 11:07 strautins

I am facing this issue randomly in my Android application. As this exception can not be caught outside of the library, this need to be caught in the library itself.

Fix of this crash is needed.

MauliShah31 avatar Jul 14 '21 11:07 MauliShah31

For me this issue was because of wrong server address/port as serverURI in new MqttClient(...). As you can see at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:116) ~ feels like message incoming decode fails.

Right, but how do I know if the address/port is correct?

zhuxiaoxue avatar May 07 '22 03:05 zhuxiaoxue