eclipse-paho / eclipse-paho/paho.mqtt.java

ReceiveMax defaults when not returned in CONNACK causes NPE when PUBLISH attempted

Open
#577 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

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

- [ ] Bug exists Release Version 1.2.0 ( Master Branch)
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
- [x ] Bug exists in MQTTv5 Client on Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)

PubMaxRM client is able to CONNECT successfully and gets the expected CONNACK, and NO value is return for 'ReceiveMax' as it should default to MAX (0xffff aka 65535)
The SPEC Says: "If the Receive Maximum value is absent, then its value defaults to 65,535." and there is no 0x21 ReceiveMax value returned.

MQTT receive 10 CONNECT connect=44 rc=0: len=50
00044d515454 0502 0023 08 11 00000008 22 0000 001d 643a6f 72673469 6f74323a 636f6e6e 50726f70 733a5075 624d6178 524d
[..MQTT...#......"....d:org4iot2:connProps:PubMaxRM]

MQTT send 20 CONNACK connect=44: len=11
0000 08 22 0008 27 0c800000 [..."..'....]

then line 996 from MQTT SERVER Trace on First Publish:
2018-08-23T15:24:43.216Z tcpiop.0 tcp.c:1761: Set error "The connection was closed by the client." (91)
2018-08-23T15:24:43.216Z tcpiop.0 mqtt.c:6565: ism_mqtt_closing: connect=44 client=d:org4iot2:connProps:PubMaxRM rc=91 clean=0 reason=The connection was closed by the client.
2018-08-23T15:24:43.216Z logger logwriter.c:166: Log logid=1111 from close_callback at tcp.c:893
2018-08-23T15:24:43.216Z logger tcp.c:893: 2018-08-23T15:24:43.216Z Connection tcpiop.0 CWLNA1111 N: Closing TCP connection: ConnectionID=44 MonitorID=44 ClientID="d:org4iot2:connProps:PubMaxRM" Protocol=mqtt5_tcp Endpoint="ExpectedMessageRateMaxEP" From=[169.53.146.15]:51028 UserID="" Uptime=4 RC=91 Reason="The connection was closed by the client." ReadBytes=52 ReadMsg=0 WriteBytes=13 WriteMsg=0 LostMsg=0 WarnMsg=0.
2018-08-23T15:24:43.216Z asyncPersist.0 mqtt.c:6709: close MQTT connection: connect=44

I don't think the PAHO Client should have NPE'd at the PUBLISH...
PAHO should have recognized that MAX is 65535 and PAHO should have been able to PUBLISH.
It is almost like PAHO thinks the value is 0 since no 0x21 was returned.

I have attached the PAHO Trace and oddly I don't see the NPE logged there.
The ClientID is show above and that is from line 847 in the imatrace.log (also attached)

[paho0.log](https://github.com/eclipse/paho.mqtt.java/files/2316747/paho0.log)

Test Case log:

[23/08/18 14:12:18:550 GMT] 000015 D ISMTEST1050: Start CompositeAction: PublishMax
[23/08/18 14:12:18:571 GMT] 00001c D ISMTEST1052: Execution thread PublishMax.1 started.

[23/08/18 14:12:18:579 GMT] 00001c I ISMTEST2517: Publishing message at QoS=1 on topic 'iot-2/evt/receiveMax/fmt/Max'
[23/08/18 14:12:18:604 GMT] 00001c I ISMTEST2519: this.connectionLost=false

[23/08/18 14:12:18:604 GMT] 00001c E ISMTEST1230: Action SendMessage: Call failed. Expected result is: SUCCESS.
Real result was ImsTestException: errorCode = ISMTEST2508. Description: null thrown attempting to send message. Cause: java.lang.NullPointerException

[23/08/18 14:12:18:611 GMT] 00001c E ISMTEST1235: Action SendMessage failed. The reason is: Result of the action is not as expected.
java.lang.RuntimeException: Result of the action is not as expected.
java.lang.RuntimeException: Result of the action is not as expected.
at com.ibm.ism.ws.test.ApiCallAction.checkExpectedResult(ApiCallAction.java:90)
at com.ibm.ism.ws.test.ApiCallAction.run(ApiCallAction.java:178)
at com.ibm.ism.ws.test.Action.execute(Action.java:256)
at com.ibm.ism.ws.test.CompositeAction$CompositeActionRunable.run(CompositeAction.java:189)
at java.lang.Thread.run(Thread.java:811)
Caused by: ImsTestException: errorCode = ISMTEST2508. Description: null thrown attempting to send message. Cause: java.lang.NullPointerException
at com.ibm.ism.ws.test.MyConnection.send(MyConnection.java:613)
at com.ibm.ism.ws.test.SendMessageAction.invokeApi(SendMessageAction.java:123)
at com.ibm.ism.ws.test.ApiCallAction.run(ApiCallAction.java:173)
... 3 more
Caused by: java.lang.NullPointerException
at org.eclipse.paho.mqttv5.client.internal.ClientState.send(ClientState.java:539)
at org.eclipse.paho.mqttv5.client.internal.ClientComms.internalSend(ClientComms.java:174)
at org.eclipse.paho.mqttv5.client.internal.ClientComms.sendNoWait(ClientComms.java:233)
at org.eclipse.paho.mqttv5.client.MqttAsyncClient.publish(MqttAsyncClient.java:1477)
at org.eclipse.paho.mqttv5.client.MqttAsyncClient.publish(MqttAsyncClient.java:1448)
at com.ibm.ism.ws.test.MyConnection.send(MyConnection.java:596)
... 5 more
[23/08/18 14:12:18:620 GMT] 00001c I ISMTEST1014: Action SendMessageAction:SendMessage failed.

--

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.