shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
552 stars 179 forks source link

Error in log while uploading images through Mqtt #142

Closed LaxmikanthMadhyastha closed 4 years ago

LaxmikanthMadhyastha commented 4 years ago

Getting error in log while trying to upload image through mqtt_client,the error is as mentioned below

I/flutter (15620): 2019-12-09 15:41:31.352173 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:31.352688 -- MqttConnection::_onData - message received MQTTMessage of type MqttMessageType.publishReceived
I/flutter (15620): Header: MessageType = MqttMessageType.publishReceived, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (15620): PublishReceived Variable Header: MessageIdentifier={23}
I/flutter (15620): 2019-12-09 15:41:31.352840 -- MqttConnection::_onData - message processed
I/flutter (15620): 2019-12-09 15:41:31.353372 -- MqttConnectionHandler::sendMessage - MQTTMessage of type MqttMessageType.publishRelease
I/flutter (15620): Header: MessageType = MqttMessageType.publishRelease, Duplicate = false, Retain = false, Qos = MqttQos.atLeastOnce, Size = 0
I/flutter (15620): PublishRelease Variable Header: MessageIdentifier={23}
I/flutter (15620): 2019-12-09 15:41:31.725415 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:31.727567 -- MqttConnection::_onData - message received MQTTMessage of type MqttMessageType.publishComplete
I/flutter (15620): Header: MessageType = MqttMessageType.publishComplete, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (15620): PublishComplete Variable Header: MessageIdentifier={23}
I/flutter (15620): 2019-12-09 15:41:31.728128 -- MqttConnection::_onData - message processed
I/flutter (15620): 2019-12-09 15:41:31.728791 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:31.728984 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:31.730606 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:31.731209 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:31.731454 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:32.188814 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:32.189803 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:32.190011 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:32.190928 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:32.191568 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:32.191762 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:32.557591 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:32.559204 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:32.559399 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:32.560334 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:32.560820 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:32.560986 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:32.926713 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:32.929 -- MqttConnection::_ondata - message is not valid
I/flutter (15620): 2019-12-09 15:41:32.929217 -- MqttConnection::_ondata - exception is mqtt-client::InvalidMessageException: The data provided in the message stream was not a valid MQTT Message, exception is mqtt-client::InvalidMessageException: Available bytes is less than the message size, bytestream is null or empty
I/flutter (15620): 2019-12-09 15:41:32.929973 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:33.026457 -- MqttConnection::_onData - message received MQTTMessage of type MqttMessageType.publish
I/flutter (15620): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.exactlyOnce, Size = 119161
I/flutter (15620): Publish Variable Header: TopicName={6389da605eb85895a2e15601d73b3de9caregiver-chatX8MGH}, MessageIdentifier={32}, VH Length={55}
I/flutter (15620): Payload: {119106 bytes={<10><36><49><55><49><97><49><55><56><97><45><55><50><97><49><45><52><54><48><102><45><97><99><50><51><45><56><51><98><57><56><55><98><56><100><101><52><101><18><4><99><104><97><116><26><189><161><7><10><9><109><101><115><115><97><103><105><110><103><18><0><24><1><34><161><161><7><255><216><255><224><0><16><74><70><73><70><0><1><1><0><0><1><0><1><0><0><255><226><2><40><73><67><67><95><80><82><79><70><73><76><69><0><1><1><0><0><2><24><0><0><0><0><2><16><0><0><109><110><116><114><82><71><66><32><88><89><90><32><0><0><0><0><0><0><0><0><0><0><0><0><97><99><115><112><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0><0>
I/flutter (15620): 2019-12-09 15:41:33.030268 -- MqttConnection::_onData - message processed
I/flutter (15620): 2019-12-09 15:41:33.031099 -- MqttConnectionHandler::sendMessage - MQTTMessage of type MqttMessageType.publishReceived
I/flutter (15620): Header: MessageType = MqttMessageType.publishReceived, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0
I/flutter (15620): PublishReceived Variable Header: MessageIdentifier={32}
I/flutter (15620): 2019-12-09 15:41:33.402452 -- MqttConnection::_onData
I/flutter (15620): 2019-12-09 15:41:33.403950 -- MqttConnection::_onData - message received MQTTMessage of type MqttMessageType.publishRelease
I/flutter (15620): Header: MessageType = MqttMessageType.publishRelease, Duplicate = false, Retain = false, Qos = MqttQos.atLeastOnce, Size = 2
I/flutter (15620): PublishRelease Variable Header: MessageIdentifier={32}
I/flutter (15620): 2019-12-09 15:41:33.404192 -- MqttConnection::_onData - message processed
I/flutter (15620): 2019-12-09 15:41:33.406303 -- MqttConnectionHandler::sendMessage - MQTTMessage of type MqttMessageType.publishComplete
I/flutter (15620): Header: MessageType = MqttMessageType.publishComplete, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0
I/flutter (15620): PublishComplete Variable Header: MessageIdentifier={32}
shamblett commented 4 years ago

OK, the failures occur before this point

I/flutter (15620): 2019-12-09 15:41:33.026457 -- MqttConnection::_onData - message received MQTTMessage of type MqttMessageType.publish
I/flutter (15620): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.exactlyOnce, Size = 119161

So does the upload eventually work, i.e. is the message size of 11961 the image in question?

LaxmikanthMadhyastha commented 4 years ago

@shamblett yes it eventually works but takes lot of time, couldn't find why the exception is

shamblett commented 4 years ago

Yes OK, the exception is misleading, it should cater for the reception of a part message before its starts to declare things as invalid, I'll fix this.

LaxmikanthMadhyastha commented 4 years ago

but is it normal to take soo much time for uploading images?

shamblett commented 4 years ago

Well, looking at the log we start at 2019-12-09 15:41:31.728128 and end at 2019-12-09 15:41:33.026457 which is approx 1.298 seconds for 119161 bytes which is about 91kb per second, depends what you expect, remember the client doesn't dictate the message reception speed, its fed by the flutter/Dart runtime, the actual client processing time is minimal.

LaxmikanthMadhyastha commented 4 years ago

Okay thanks a lot for the quick response, looking forward for the fix regarding the exception

shamblett commented 4 years ago

Updated, re-published at version 5.6.3