rumqtt icon indicating copy to clipboard operation
rumqtt copied to clipboard

rumqttc lacks happy eyeballs, fails all connections due to timeout on first resolved IP

Open Spindel opened this issue 1 year ago • 0 comments

So, this is a bit of a doozy, I've got a device in the field that has some funky routing going on for ipv6, meaning it resolves and works on the local LAN, but isn't routed properly.

This means that rumqttc client will fail all connections when connect timeout is set to a value less than ~5 minutes, as the code in socket_connect will stall on the first ip resolved, and then block further execution and be trapped by the total connection timeout.

Some possible solutions:

  • Use the happy eyeballs crate as dependency
  • Reimplement it in rumqttc directly
  • Ignore the problem and face more annoyance/forks

How to replicate:

  • Set up a DNS host with multiple IP's resolving to both ipv4 and ipv6
  • Make the first one not respond due to routing data (black hole, not a closed port)
  • Set rumqttc to connect with a connection timeout

Desired functionality:

  • When given multiple IP addresses on both IPv4 and IPv6, a single slow one should not prevent others from working.

Spindel avatar Jan 28 '25 11:01 Spindel