moscajs / aedes

Barebone MQTT broker that can run on any stream server, the node way
MIT License
1.75k stars 228 forks source link

[bug] Not all messages are consumed when dedupe is enabled #955

Open zagadheesh opened 1 month ago

zagadheesh commented 1 month ago

System Information

Describe the bug I'm currently experiencing an issue while running Aedes alongside an MQTT Java client using example.js (attached) with no modifications to the aedes source code. Despite running both the consumer and producer, it seems that certain messages aren't being consumed. Interestingly, after commenting out the 'dedupe' call in the client.js file of the Aedes source code, the consumer is able to successfully consume all messages.

To Reproduce Steps to reproduce the behavior:

  1. Run the broker using example.js on aedes 0.51.1 source code
  2. Run AedesSampleConsumer.java
  3. Run AedesSampleProducer.java

Expected behavior Consumer should consume all the messages produced.

aedes-problem-demo.zip

robertsLando commented 1 month ago

@zagadheesh I have actually no time to dig into this, could you do try to draft a PR to fix the issue? I already fixed dedupe a while ago for the same reason and the problem was the persistence used

zagadheesh commented 1 month ago

@robertsLando The proposed pull request would involve commenting out the 'dedupe' call in client.js. After conducting tests on release 0.42.6 without altering any source code, I observed that the consumer successfully consumed all messages. However, beyond this change, I haven't delved into the entirety of the source code. Any suggestions would be greatly appreciated!

robertsLando commented 1 month ago

Commenting the dedupe fn is not the solution, it is there for a reason and it should stay there, we need to find out why the messages are not deduped correctly.

Would be better if you can reproduce the same with a consumer'producer in nodejs instead of java

zagadheesh commented 1 month ago

Reproduced the same in node.js. Please find attched zip file which contains example.js which starts the broker with required configuration along with producer.js and consumer.js files.

sample.zip