Closed 9mdaniel closed 2 months ago
Stack Trace:
MqttMessage.createFrom (c:\Users\\AppData\Local\Pub\Cache\hosted\pub.dev\mqtt_client-10.2.0\lib\src\messages\mqtt_client_mqtt_message.dart:48) MqttServerConnection.onData (c:\Users\\AppData\Local\Pub\Cache\hosted\pub.dev\mqtt_client-10.2.0\lib\src\connectionhandling\server\mqtt_client_mqtt_server_connection.dart:57) _RootZone.runUnaryGuarded (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\zone.dart:1594) _BufferingStreamSubscription._sendData (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_impl.dart:339) _BufferingStreamSubscription._add (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_impl.dart:271) _SyncStreamControllerDispatch._sendData (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_controller.dart:784) _StreamController._add (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_controller.dart:658) _StreamController.add (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_controller.dart:606) _Socket._onData (dart:io-patch/socket_patch.dart:2447) _RootZone.runUnaryGuarded (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\zone.dart:1594) _BufferingStreamSubscription._sendData (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_impl.dart:339) _BufferingStreamSubscription._add (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_impl.dart:271) _SyncStreamControllerDispatch._sendData (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_controller.dart:784) _StreamController._add (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_controller.dart:658) _StreamController.add (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\stream_controller.dart:606) new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1936) _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1379) _microtaskLoop (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\schedule_microtask.dart:40) _startMicrotaskLoop (c:\Users\\flutter\bin\cache\pkg\sky_engine\lib\async\schedule_microtask.dart:49)
@shamblett Need your expertise here as well :)
OK, your message stream isn't getting full, its being starved, this -
messageStream.availableBytes < header.messageSize
96 < 156
is saying the message length as sent from the broker is 156 bytes but only 96 are available.
There are edge cases here where this is not true, a patch was added to the mqtt5_client in this very area.
In fact, if possible could you just swap to the mqtt5_client and run your scenario, it should be a drop in replacement as long as your broker supports the MQTT5 protocol of course.
ok let me move to mqtt5_client and let you know, thanks!! will close the issue once im done testing
I am using mqtt_client with my broker being localhost, I have 5 topics and 2 topics receive messages every 2 seconds.
I am getting an exception in my flutter code
messageStream.availableBytes < header.messageSize 96 < 156 "Available bytes is less than the message size" which then resets the messageStream. My QOS level is atMostOnce 0.
Why is my message stream getting full? How to handle this?
I use startClean on the client instance every time the app is launched and unsubscribe and dispose/close as well for every topic on unload