QOS 2 messages dropped by bridge. #151

Closed
andrewchambers opened this Issue May 5, 2016 · 2 comments

Projects

None yet

2 participants

@andrewchambers
andrewchambers commented May 5, 2016 edited

I am attempted to bridge 2 brokers and subscribe to one end, and publish to the other, and can see messages are getting lost.

Steps to reproduce:

Using mosquitto version 1.4.8

1.) Run broker with settings:

port 9001
retry_interval 3
persistence true

2.) Run broker + bridge with settings:

port 9000
persistence true
retry_interval 3

connection hqbridge
restart_timeout 3
cleansession false
address 127.0.0.1:9001
topic /i/+/loads out 2
topic /i/+/hq in 2

3.) Establish a non clean subscription to bridge broker with a fixed id

 mosquitto_sub -h localhost -p 9000 -t "/i/+/hq" -c -q 2 -i i0

4.) Close subscriber from step 3. Close bridge from step 2. Now only the broker from step 1 is running.

5.) publish a message with

mosquitto_pub -h localhost -p 9001 -q 2 -t "/i/i0/hq" -m "abc"

6.) restart broker/bridge from step 2. If -v is enabled, observe it recieve the abc message.

7.) rerun subscription from step 3. Observe the message is lost.

@ralight
Contributor
ralight commented May 5, 2016

This appears to be a bug with persisting topics that start with a /, thanks for reporting it.

You can get around it for now by removing the leading /. Honestly, there's no reason to have it there you're just complicating your hierarchy. Unlike a unix file system, / isn't the base, "" is. Using /i/i0/hq as a topic gives you four levels of hierarchy "", "i", "i0", "hq".

@andrewchambers

Thank you for looking at this so fast, and thanks for the advice.

@ralight ralight added a commit that referenced this issue May 14, 2016
@ralight ralight Fix saving of persistence messages that start with a '/'.
Closes #151. Thanks to Andrew Chambers.

Signed-off-by: Roger A. Light <roger@atchoo.org>
57da586
@ralight ralight closed this May 14, 2016
@ralight ralight added this to the 1.4.9 milestone May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment