question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] `pubrel` delivery re-try causes `no such packet` error

See original GitHub issue

System Information

  • Aedes: 0.42.5
  • NodeJS: v14.15.4
  • OS: MacOS 10.15.7
  • Arch: x86_64

Describe the bug When receiving pubrel packet for a message that’s been already fully processed from the broker’s point of view, the broker logs no such packet error and disconnects. The client. If the client didn’t receive the initial pubcomp and wants to resend the pubrel upon reconnection, this will lead to a re-connection loop, where the client would connect, send pubrel, get disconnected, re-connect, send pubrel, get disconnected and so on.

To Reproduce Run the publish QoS 2, pubrel delivery retry test I’ve added here.

Expected behavior The broker should neither emit any error nor disconnect the client when receiving pubrel packet for already pubcomped message. It should send the pubcomp once more instead.

Additional context According to the MQTT spec the client

MUST re-send any unacknowledged PUBLISH Packets (where QoS > 0) and PUBREL Packets using their original Packet Identifiers

so conforming to this should not cause any errors.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
robertsLandocommented, May 6, 2021

Redis: https://github.com/moscajs/aedes-persistence-redis/blob/master/persistence.js#L524 Mongodb: https://github.com/moscajs/aedes-persistence-mongodb/blob/master/persistence.js#L613

We should also patch persistence to return something that allow to distinguish errors correctly.

I also noticed that not just the error message changes but also mongo returns null and client as params where redis returns only the error. I think the steps here are to firstly add a test to abstract test of aedes persistence that checks the error returned when there is no packet found is the same across all persistences then patch all them

0reactions
tomekt-boltcommented, May 6, 2021

Oh ok so you mean that in general he should always reply to a pubrel with a pubcomp even if there is no packet matching in store?

I think replying with pubcomp to pubrel for message we don’t have in the persistence is the only viable option, unless I’m missing something. Not sure though if it should be the same if we have the message in the persistence, but we haven’t pubreced it yet - in such situation the pubrel would be unexpected. But maybe there’s no need to bother with this.

the error could be quite easy to fix, we could completely ignore all errors or just ignore packets not found errors

I wouldn’t like to ignore all the errors. I guess there could be some other errors like not having the active connection to the underlying redis (or whatever persistence) and in such cases the error should be properly propagated, not suppressed. Ignoring the no such packet error specifically could work here, but I’m a bit afraid on relying on this hardcoded string. Are all the persistence implementations guaranteed to use the very same string?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Broker stops retransmitting at QOS1 when client does not ...
4.4 Message delivery retry When a Client reconnects with CleanSession set to 0, both the Client and Server MUST re-send any unacknowledged ...
Read more >
R: R: Paho Java Client retransmission implementation - Eclipse
Message delivery retries are not performed on reconnect because the broker is not required to maintain the client state across reconnects.
Read more >
aedes - Bountysource
When receiving pubrel packet for a message that's been already fully processed from the broker's point of view, the broker logs no such...
Read more >
MQTT 5 message delivery retry - Stack Overflow
I am talking about "4.4 Message delivery retry" of the specs. What happens if your client uses no session (cleanStart = true) and...
Read more >
Diff - third_party/lwip - fuchsia Git repositories
lwIP does not place any restrictions on how these types are represented internally. ... IPv6 header of the packet which caused the error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found