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 · 11 comments

Comments

Projects
None yet
4 participants
@mturalenka

mturalenka commented Jul 5, 2017

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

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Jul 5, 2017

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@mturalenka

mturalenka Jul 5, 2017

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

mturalenka commented Jul 5, 2017

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

@ralight

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Jul 5, 2017

Contributor

Which version did you end up with?

Contributor

ralight commented Jul 5, 2017

Which version did you end up with?

@mturalenka

This comment has been minimized.

Show comment
Hide comment
@mturalenka

mturalenka Jul 5, 2017

@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

mturalenka commented Jul 5, 2017

@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

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Jul 5, 2017

Contributor

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

Contributor

ralight commented Jul 5, 2017

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

@ralight

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Jul 7, 2017

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@mturalenka

mturalenka Jul 10, 2017

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

mturalenka commented Jul 10, 2017

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

@ralight

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Jul 10, 2017

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@bluecatr

bluecatr 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

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

@chinausers

This comment has been minimized.

Show comment
Hide comment
@chinausers

chinausers Sep 19, 2018

is there any update for this issue? thanks .

chinausers commented Sep 19, 2018

is there any update for this issue? thanks .

@ralight

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Sep 19, 2018

Contributor

I believe this should now be fixed.

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

@ralight ralight closed this in 2b4ba10 Sep 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment