-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
net: mqtt: Add write message handler #22794
net: mqtt: Add write message handler #22794
Conversation
`mqtt_transport_write` failue was logged with `errno` value which is not correct as the return value from the function is valid in this case. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new transport handler for MQTT, with sendmsg-like functionality. This allows TCP transport to send PUBLISH packets w/o fragmentation at the TCP layer. Implement this new functionality for all existing transports. Fixes zephyrproject-rtos#22679 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
FYI @JusbeR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works in my setup with mqtt_client.transport.type = MQTT_TRANSPORT_SECURE_WEBSOCKET
.
@jukkar this seems more of an enhancement than a bug fix. Were you planning on requesting TSC approval for it (considering that you added the 2.2 milestone)? |
True, I will set the milestone to 2.3 which is more appropriate in this case. |
Can we double check this PR as my MQTT connections now reject upon first message send...
|
@WilliamGFish Any more details on your setup perhaps? I've tested this change with qemu/local mosquitto server and nRF91 (offloaded sockets) with nRF Cloud, both worked fine. |
I am using the PArticle Argon with esp32 (esp8266 modem driver) with offloaded sockets. This was working two days ago and had sen t over 500,000 messages without a failure. This wold be using the NET_TCP option therefore using the mqtt_client_tcp_write_msg() function. Not sure quite was is happening as error code does not appear to make sense (EKEYEXPIRED ) |
Found there is a bug/s in the modem driver that has been dramatically exposed by these changes. |
@WilliamGFish Cool! Which driver? |
I am using the Particle Argon with esp32 (esp8266 modem driver) with offloaded sockets. This was working two days ago and had sent over 500,000 messages without a failure. The offending logic in {esp8266_offload.c} esp8266_sendto()
The logic seems confusing but by removing this the driver is back working again. I am looking at other drivers but haven't found the same unusual logic. |
Doh. This pull request breaks MQTT for sufficiently large payloads. The call to sendmsg only checks pass/fail, not how many bytes were sent... Our application is stuck on this, so I'll be working on a fix. |
And it looks like the implementation of |
After a bit more reading, I realized sendmsg is supposed to be all or nothing, and never return partial success. My issue was entirely in the NRF sendmsg implementation. I just opened a pull request with a fix on the NRF repository here. |
Add new transport handler for MQTT, with sendmsg-like functionality.
This allows TCP transport to send PUBLISH packets w/o fragmentation at
the TCP layer. Implement this new functionality for all existing
transports.
Fixes #22679
Signed-off-by: Robert Lubos robert.lubos@nordicsemi.no