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

After v1.5.4: bridge doesn't queue up messages when connection not active #1174

Closed
beville opened this Issue Feb 18, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@beville
Copy link

beville commented Feb 18, 2019

We have a mobile device, using a cell modem for network connectivity. We are currently using mosquitto 1.5.1 to act a bridge to the remote broker. The idea is that local MQTT client apps can connect exclusively to the local bridge, and don't worry about mobile connectivity. We'd like to keep our version of mosquitto up to date, but have run into a problem. Here's what we see with regards to the bridge handing messages when connectivity is down.


With 1.5.1 this works fine. The sequence I see is this:

  1. Mosquitto starts up, reads the config which has this line under the bridge section:
    topic device/intro out 1 "" ""
  2. Mosquitto seems to subscribe to the topic 'device/intro' immediately:
    mosquitto[1195]: Bridge local.device.bridge doing local SUBSCRIBE on topic device/intro
  3. Client connects, and publishes message with topic 'device/intro', and mosquitto queues it up.
  4. Data connection is established, and the device has an IP address on cell network.
  5. Mosquitto connects to remote broker
  6. Mosquitto publishes 'device/intro' message

This above seems true up to version 1.5.4.


From 1.5.5 on, this is what I see:

  1. Mosquitto starts up, reads the config which has this line under the bridge section:
    topic device/intro out 1 "" ""
  2. Client connects, and publishes message with topic 'device/intro'
  3. Data connection is established, and the device has an IP address on cell network.
  4. Mosquitto connects to remote broker
  5. Mosquitto seems to subscribe to the topic 'device/intro':
    mosquitto[1195]: Bridge local.device.bridge doing local SUBSCRIBE on topic device/intro
  6. Mosquitto does not publish 'device/intro' message

So it appears that the message is now being discarded because of the timing of the subscription relative to the connection the remote broker. It seems like the bridge shouldn't be discarding any configured outgoing message topics regardless of current connectivity.

@ralight

This comment has been minimized.

Copy link
Contributor

ralight commented Feb 19, 2019

Thanks, I'll take a look (I'm currently traveling though). Could you just confirming what platform you are running on?

@beville

This comment has been minimized.

Copy link
Author

beville commented Feb 19, 2019

Linux, on an arm7.

I'm pretty the change is related to this commit: 464b12f

Some other info, config for the bridge has cleansession=false, and test messages are QoS=1

@ralight

This comment has been minimized.

Copy link
Contributor

ralight commented Feb 28, 2019

I've added some tests and a fix, and intend to make a release today.

@ralight ralight added this to the 1.5.8 milestone Feb 28, 2019

@beville

This comment has been minimized.

Copy link
Author

beville commented Feb 28, 2019

Fantastic, thanks for addressing this so quickly!

@ralight ralight closed this in 7207041 Feb 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.