mqtt error 16 during publish

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
ttadam
Posts: 10
Joined: Sun Apr 26, 2020 3:36 pm

mqtt error 16 during publish

Post by ttadam » Tue Oct 13, 2020 8:35 am

Hello there,

Well, I stuck therefore I ask some help from the community. I have an esp32, what sends to an mqtt server, and after a few (like 5 or 6) publish I receive an error 16, and after that that is the only thing what happening every time when the board wants to publish.
Did some digging, I found here that 16 means "Malformed received MQTT packet . I don't really know what does that mean, or how to prevent it.

Thanks in advance! :)

User avatar
pythoncoder
Posts: 4641
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mqtt error 16 during publish

Post by pythoncoder » Tue Oct 13, 2020 12:13 pm

I suggest you tell us which MicroPython MQTT library you're using. Also what broker software you're running, and on what platform.
Peter Hinch

ttadam
Posts: 10
Joined: Sun Apr 26, 2020 3:36 pm

Re: mqtt error 16 during publish

Post by ttadam » Tue Oct 13, 2020 1:13 pm

I am using mqtt simple.
The server/Broker is emqx v4.

User avatar
pythoncoder
Posts: 4641
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mqtt error 16 during publish

Post by pythoncoder » Wed Oct 14, 2020 8:06 am

Any chance of trying mosquitto for your broker to see if this has any effect? It's available in most Linux distros.

As far as I know all testing has been done using this. I've never seen this error.
Peter Hinch

ttadam
Posts: 10
Joined: Sun Apr 26, 2020 3:36 pm

Re: mqtt error 16 during publish

Post by ttadam » Thu Oct 22, 2020 9:57 am

I think I got closer to the issue. It is not mqtt error 16, it is an OSError 16... and coming from the mqtt library from this line:
self.sock = ussl.wrap_socket(self.sock, **self.ssl_params)

Post Reply