Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiniMQTT sends malformed messages when messages are too large #230

Closed
manchicken opened this issue Jan 1, 2025 · 3 comments · Fixed by #231
Closed

MiniMQTT sends malformed messages when messages are too large #230

manchicken opened this issue Jan 1, 2025 · 3 comments · Fixed by #231

Comments

@manchicken
Copy link
Contributor

manchicken commented Jan 1, 2025

I've been working on a small device which sends small JPEG photos via MQTT, and it's been giving me difficulty because the messages just never seemed to queue properly whether I'm using Adafruit IO or another MQTT broker (RabbitMQ's MQTT plugin, in this instance).

I put together this code snippet which fails for me 100% of the time on both Adafruit IO+ as well as with RabbitMQ's MQTT plugin: https://gist.github.com/manchicken/36b6d530eec03871f5a5e24834a2266a

Here are the logs I get from RabbitMQ (I don't know how to get comparable logs from Adafruit IO+): https://gist.github.com/manchicken/5fcddcc26c54b72a9705eebfd8bebc3e

(Apologies for the horizontal scrolling, I copied those verbatim from the RMQ logs)

It seems like there's something that happens once you get past 2.833KB which causes the messages to be malformatted.

Versions:

  • Board: Raspberry Pi Pico 2W (2350)
  • CircuitPython firmware version: adafruit-circuitpython-raspberry_pi_pico2_w-en_US-9.2.1
  • Adafruit libraries version: adafruit-circuitpython-bundle-9.x-mpy-20241224
  • RabbitMQ version: 3.10.8-1.1+deb12u1
  • rabbitmq_mqtt: 3.10.8

Please let me know if there's any additional information that would be helpful.

@justmobilize
Copy link
Collaborator

Couple of random questions:

  1. Have you tested this on other boards?
  2. Is AIO, your goal? If so you could do a request post (doesn't fix the bug, but unblocks you)

@dhalbert
Copy link
Contributor

dhalbert commented Jan 1, 2025

I've found what I think is a bug in MiniMQTT (using .send() instead of .sendall() or similar to send data to a socket) and am debugging this with the user.

@manchicken
Copy link
Contributor Author

I just tried @dhalbert's fix prototype and it works! Thank you, @dhalbert!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants