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

Bridge connection fails with multiple addresses #481

Closed
mturalenka opened this issue Jul 5, 2017 · 12 comments
Closed

Bridge connection fails with multiple addresses #481

mturalenka opened this issue Jul 5, 2017 · 12 comments

Comments

@mturalenka
Copy link

We have bridge configured with multiple addresses. when the primary(first) address goes down(manually or due to some issue) mosquitto trying to connect to the second address specified in bridge configuration but all time gets error:

Jul 5 07:53:25 staging-mosquitto-slave1 mosquitto[28562]: Connecting bridge awsmasterconnection (address2:8883)
Jul 5 07:53:25 staging-mosquitto-slave1 mosquitto[28562]: Socket error on client local.staging-mosquitto-slave1.awsmasterconnection, disconnecting.

if to place this address on a first position in configuration, connection is created.
i found that this issue was already mentioned in #31 as possible bug in a fix
if set round_robin true issue disappears

Name        : mosquitto
Arch          : x86_64
Version     : 1.4.10
Release     : 3.1
#/etc/mosquitto/mosquitto.conf
pid_file /var/run/mosquitto.pid
user mosquitto
persistence true
persistence_location /var/lib/mosquitto/
log_dest syslog
include_dir /etc/mosquitto/conf.d
#/etc/mosquitto/conf.d/bridge.conf
connection awsmasterconnection
addresses address1:8883 address2:8883
topic in/# both 1
topic out/# out 1 "" staging_mosquitto_slave1/
bridge_insecure true
cleansession true
start_type automatic
log_type all
remote_username mosquitto_bridge_user
remote_password mosquitto_bridge_password
local_username mosquitto_bridge_user
local_password mosquitto_bridge_password
tls_version tlsv1.2
#Path to the rootCA
bridge_cafile /etc/mosquitto/certs/bridge_cafile.crt
# Path to the PEM encoded client certificate
bridge_certfile /etc/mosquitto/certs/bridge_certfile.crt
# Path to the PEM encoded client private key
bridge_keyfile /etc/mosquitto/certs/bridge_keyfile.key
@ralight
Copy link
Contributor

ralight commented Jul 5, 2017

There were some bridge related fixes in version 1.4.11 and 1.4.12, could you please try updating?

@mturalenka
Copy link
Author

Hi, thank you for a quick reply. just tried to update. still the same issue

@ralight
Copy link
Contributor

ralight commented Jul 5, 2017

Which version did you end up with?

@mturalenka
Copy link
Author

@ralight latest you mentioned

Name        : mosquitto
Arch          : x86_64
Version     : 1.4.12
Release     : 3.1

i suppose the issue is as mentioned Johnny Egeland in #31 ticket in loop.c file with round_robin checks and code executed if its false

@ralight
Copy link
Contributor

ralight commented Jul 5, 2017

Ok, I'll have to take a proper look later.

@ralight
Copy link
Contributor

ralight commented Jul 7, 2017

I've reproduced it and fixed part of the problem, but still have to track down the bit which means the reconnection fails.

@mturalenka
Copy link
Author

@ralight Hi, do you have any update regarding this issue?

@ralight
Copy link
Contributor

ralight commented Jul 10, 2017

It is proving difficult to deal with for non blocking sockets and so will require a bit of a think to see whether it can be done without a lot of code change. The problem is that connect() with a non blocking socket doesn't allow you to distinguish between a potentially successful connection and the situation where the connection is definitely refused. You have to wait for that to resolve, and the code isn't set up for that type of check at the moment.

@bluecatr
Copy link

bluecatr commented Feb 7, 2018

hi, meet this same problem with the version 1.4.14
In each mosquitto node(I have two nodes) mosquitto.conf, I have the setting below, if I stop the bridge server1, I can see the log that two nodes are trying to connect the bridge server2 with message: Socket error on *******, disconnecting.
If I set round_robin as true, it works fine. but the behaviour of bridges with multiple addresses is not what I want.

addresses server1:8883 server2:8883
round_robin false

@ralight is there any update for this issue? thanks

@BrokenWingsIcarus
Copy link

is there any update for this issue? thanks .

@ralight
Copy link
Contributor

ralight commented Sep 19, 2018

I believe this should now be fixed.

@ralight ralight added this to the 1.5.2 milestone Sep 19, 2018
@mcli
Copy link

mcli commented Oct 27, 2018

Initial tests with 1.5.3 tag indicate that the problem is not fixed. If the first broker is not up, both connections still fail. changing round_robin to true results in a successful connection.

ralight added a commit that referenced this issue Nov 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants