Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Weird behaviour when using two bridges with the same clientId

Hi Øyvind,

I agree, that is confusing behaviour. The problem exists because the
bridge must have a client id on the local broker as well. If you don't
set this explicitly with the local_clientid option, then it is
automatically created as local.<value of remote_clientid>. Note that
remote_clientid and clientid are synonymous. In your case this means
odd things happen because of the non-unique clientid.

I will be changing this to produce an error for a future release,
thanks for bringing it up.

Cheers,

Roger


On Tue, Jun 9, 2015 at 7:02 PM, Øyvind 'bolt' Hvidsten <bolt@xxxxxxxxxx> wrote:
> Using the following config for test purposes:
> ----------------------------------
> max_inflight_messages 1
> max_queued_messages 1000
> allow_zero_length_clientid false
> auto_id_prefix auto-
> persistent_client_expiration 1m
> port 9001
> log_dest none
> log_dest stderr
> connection_messages true
>
> connection test2
> address localhost:9002
> topic # out 0 local/ remote/
> clientid test1
> keepalive_interval 10
> restart_timeout 3
> start_type automatic
> try_private true
>
> connection test3
> address localhost:9003
> topic # out 0 local/ remote/
> clientid test1
> keepalive_interval 10
> restart_timeout 3
> start_type automatic
> try_private true
> ----------------------------------
>
> When both the "remote" servers, at ports 9002 and 9003, are not running,
> this is the result:
> ----------------------------------
> 1433871614: mosquitto version 1.3.4 (build date 2014-08-17 03:38:31+0000)
> starting
> 1433871614: Config loaded from test1.conf.
> 1433871614: Opening ipv4 listen socket on port 9001.
> 1433871614: Opening ipv6 listen socket on port 9001.
> 1433871614: Connecting bridge test2 (localhost:9002)
> 1433871614: Error creating bridge: Connection refused.
> 1433871614: Warning: Unable to connect to bridge test2.
> 1433871614: Connecting bridge test3 (localhost:9003)
> 1433871614: Error creating bridge: Connection refused.
> 1433871614: Warning: Unable to connect to bridge test3.
> 1433871618: Connecting bridge test3 (localhost:9003)
> 1433871618: Error creating bridge: Connection refused.
> 1433871622: Connecting bridge test3 (localhost:9003)
> 1433871622: Error creating bridge: Connection refused.
> 1433871626: Connecting bridge test3 (localhost:9003)
> 1433871626: Error creating bridge: Connection refused.
> 1433871630: Connecting bridge test3 (localhost:9003)
> 1433871630: Error creating bridge: Connection refused.
> 1433871634: Connecting bridge test3 (localhost:9003)
> 1433871634: Error creating bridge: Connection refused.
> 1433871638: Connecting bridge test3 (localhost:9003)
> 1433871638: Error creating bridge: Connection refused.
> ----------------------------------
>
> As you can see, mosquitto happily accepted the config, attempted to connect
> to port 9002 once, and then kept polling 9003. Even if 9003 was brought up,
> it would never again attempt port 9002.
>
> The problem turned out to be that I used the same clientId for my
> connections, as I wanted to identify as the server "test1" on both remote
> servers. Changing these to "test1_2" and "test1_3", it would poll both
> servers as expected.
>
> I found this very unintuitive, and thought I'd give some feedback about
> that. I would expect this to work fine, as none of the servers should end up
> seeing two "test1" clientId's, but at the very least this should produce an
> appropriate error message rather than the weird situation shown above.
>
>
> Best regards,
> Øyvind Hvidsten
> _______________________________________________
> mosquitto-dev mailing list
> mosquitto-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top