Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] persistent connection failure when v6 is not working

Hi Greg,

The bridges use getaddrinfo() to determine what to connect to, and
will try whichever of IPv4 and IPv6 is offered first. If that fails it
should go on to the next address. Looking at it though, it's possible
if the first connection attempt doesn't immediately fail but is still
pending because it is a non-blocking socket, then we could end up in
the situation that getaddrinfo always returns the same address first,
so we try to connect, it half completes so we drop out of the
getaddrinfo loop, then it later fails and we retry and get the same
failing address.

I could try tracking whether IPv4/6 work, but then that is going to
cause problems if the host is actually down. Maybe I'll just make
bridge connections blocking, but in another thread, in the great big
bridge overhaul of the future.



On Wed, 26 Jan 2022 at 01:58, Greg Troxel <gdt@xxxxxxxxxx> wrote:
> I'm running 2.0.14 on NetBSD 9.  Things have been 99.9% working.
> I have two brokers, A and B, and A is configured to bridge to B.   A and
> B have both v4 and v6 addresses and normally both work fine.
> I just restarted A and for reasons unknown but not really relevant the
> v6 config on B (there is a private tunnel) was messed up, and A could
> not connect to B over v6.   This could have happened anyway.
> Apparently mosquitto did not try the v4 address.   I had not noticed it
> was dicsonnected, but when I fixed the v6 config, I got restore
> notifications (of the bridge, and some data posted to A that is supposed
> to show up on B).
> (I have a dim memory of posting about this before, but I don't find my
> message in my local saved messages.)
> Is anyone else seeing this?  Is anyone seeing mosquitto try the full set
> of addresses round robin until one works, as it should?
> Thanks,
> Greg
> _______________________________________________
> mosquitto-dev mailing list
> mosquitto-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit

Back to the top