Skip to content
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

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

Open
Spindel opened this issue Jan 28, 2025 · 0 comments

Comments

@Spindel
Copy link

Spindel commented Jan 28, 2025

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 added a commit to Spindel/rumqtt that referenced this issue Jan 29, 2025
In case of routing issues, the individual socket connections will take
~4.5 minutes depending on OS level socket syn retransmit settings, which
means that if there is a connection timeout that is shorter than that,
connection will never be established even if other IP's resolve and
route properly.

This implements concurrent connection attempts with a staggerd delay
between attempts. I have chosen not to implement a full version of
RFC8305 (Happy Eyeballs) here, as that is a much more invasive change.

Signed-off-by: D.S. Ljungmark <[email protected]>
Issue: bytebeamio#939
Spindel added a commit to Spindel/rumqtt that referenced this issue Jan 29, 2025
In case of routing issues, the individual socket connections will take
~4.5 minutes depending on OS level socket syn retransmit settings, which
means that if there is a connection timeout that is shorter than that,
connection will never be established even if other IP's resolve and
route properly.

This implements concurrent connection attempts with a staggerd delay
between attempts. I have chosen not to implement a full version of
RFC8305 (Happy Eyeballs) here, as that is a much more invasive change.

Signed-off-by: D.S. Ljungmark <[email protected]>
Issue: bytebeamio#939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant