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
There were some bridge related fixes in version 1.4.11 and 1.4.12, could you please try updating?
Hi, thank you for a quick reply. just tried to update. still the same issue
Which version did you end up with?
@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
Ok, I'll have to take a proper look later.
I've reproduced it and fixed part of the problem, but still have to track down the bit which means the reconnection fails.
@ralight Hi, do you have any update regarding this issue?
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.
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
is there any update for this issue? thanks .
I believe this should now be fixed.
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.