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

Unable to get NanoMQ implementation of Retained Messages to function correctly #1769

Closed
codetronics opened this issue May 2, 2024 · 6 comments
Assignees
Labels
bug feedback Waiting for futher feedbacks

Comments

@codetronics
Copy link

Describe the bug
Cannot get the Retained Messages feature to work correctly with nanomq:0.21.9-full docker image over TLS. Once a message with retain flag is set and published, the same client with the intended topic already subscribed will cause a failure on reconnect. We are using the following tutorial to get the 'Retained Messages' feature to function.

https://nanomq.io/docs/en/latest/tutorial/retain-msg-persistence.html

Expected behavior
Supposed to work correctly like with EMQX broker.

Actual Behavior
Client is unable to establish connection with the broker if the subscribed topic has a retained message.

To Reproduce
We are testing the docker version of nanomq.

Clear /tmp content, restart nanomq app and then try to send a retain message to topic A. Subscribe to the topic A with the same client and then try to reconnect. Message should persist.

Environment Details

  • NanoMQ version = 0.21.9-full
  • Operating system and version = Ubuntu 20.04 LTS (ARM 32-bit Allwinner A20 SoC)
  • Testing scenario = Docker Environment

Additional context
Below is the log from NanoMQ when the failure occurs.

nanomq.log

Below is the log from MQTTX client on failure to reconnect :-

[2024-05-02 17:20:21] [INFO] Resubscription in progress for topic: test/topic
[2024-05-02 17:20:21] [ERROR] Error subscribing to topic: Error: Connection closed
[2024-05-02 17:20:21] [ERROR] Connection for 192.168.20.101 failed, MQTT.js onError trigger, Error: Error: Invalid variable byte integer
@JaylinYu
Copy link
Member

JaylinYu commented May 5, 2024

Thanks for reporting issue
0.21.9 is a pre-release ver, could u confirm with 0.21.8 as well?

@codetronics
Copy link
Author

We've tried as old as 0.21.5-full and the problem is still there. We observed a weird behavior with the non-TLS connection, though. Somehow, the retain feature works fine over non-TLS connection. Upon multiple manual connect/disconnect, we are able to get the retained message with MQTTX.

If we publish a retained message over non-TLS connection, and try to connect over TLS connection with the same subscription, then we can actually receive the retained message without any issue. However, once we publish the same retained message over TLS, then the issue comes back.

We have even tested with MQTT Version 3.1, and the issue is still there.

Hope that helps. Thank you.

@JaylinYu JaylinYu added the bug label May 7, 2024
@JaylinYu JaylinYu self-assigned this May 7, 2024
JaylinYu added a commit to nanomq/NanoNNG that referenced this issue May 13, 2024
Signed-off-by: jaylin <jaylin@emqx.io>
@JaylinYu
Copy link
Member

JaylinYu commented May 13, 2024

A great catch!Thank you! @codetronics
Your issue report is the most detailed one I have ever seen!

@codetronics
Copy link
Author

We are happy to be of great help, and glad that the issue is fixed. Thank you!

@JaylinYu JaylinYu added the feedback Waiting for futher feedbacks label May 14, 2024
@JaylinYu
Copy link
Member

Will publish a 0.21.10 release soon. happy to get any feedback from you.

@codetronics
Copy link
Author

Tested the latest 0.21.10-full docker image and the reported issue is resolved. Thank you very much! @JaylinYu

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

No branches or pull requests

2 participants