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

IPV4 error for dualstack cluster without IPV6 connectivity #139

Open
laskoviymishka opened this issue Mar 13, 2024 · 1 comment
Open

IPV4 error for dualstack cluster without IPV6 connectivity #139

laskoviymishka opened this issue Mar 13, 2024 · 1 comment

Comments

@laskoviymishka
Copy link

When we try to connect to Postgres inside dual-stack network (ipv4 and ipv6) we face confusing error:

failed to connect to `host=chinook.chiyepnb01it.eu-west-2.rds.amazonaws.com user=tutorial database=chinook`: dial error (timeout: dial tcp 10.0.102.63:5432: i/o timeout)

Given:

Cluster with ipv4 and ipv6 address:

host chinook.chiyepnb01it.eu-west-2.rds.amazonaws.com
chinook.chiyepnb01it.eu-west-2.rds.amazonaws.com has address 10.0.102.63
chinook.chiyepnb01it.eu-west-2.rds.amazonaws.com has IPv6 address 2a05:d01c:d05:6500:3318:e752:f216:3d9b

IPv4 connectivity exists:

telnet 10.0.102.63 5432
Trying 10.0.102.63...
Connected to 10.0.102.63.
Escape character is '^]'.

IPv6 connectivity not exists:

 telnet 2a05:d01c:d05:6500:3318:e752:f216:3d9b 5432
Trying 2a05:d01c:d05:6500:3318:e752:f216:3d9b...
^C

Connection failed (wich is expected), but error should be:

failed to connect to `host=chinook.chiyepnb01it.eu-west-2.rds.amazonaws.com user=tutorial database=chinook`: dial error (timeout: dial tcp [2a05:d01c:d05:6500:3318:e752:f216:3d9b]:5432: i/o timeout)
@laskoviymishka
Copy link
Author

Side note:

In pgx/v5 its not reproduceable:

failed to connect to `host=chinook.chiyepnb01it.eu-west-2.rds.amazonaws.com user=tutorial database=chinook`: dial error (timeout: context deadline exceeded)

Error is less verbose

laskoviymishka added a commit to laskoviymishka/pgconn that referenced this issue Mar 13, 2024
Fixing IPV4 error for dualstack cluster without IPV6 connectivity jackc#139
laskoviymishka added a commit to laskoviymishka/pgx that referenced this issue Mar 13, 2024
Fixes: jackc#1942

Once we face a timeout we should expose address, it can be for example ipv6 or ipv4 and knowing what exact address we took for resolver extreamly helpful for triaging a networking issue.

This issue is also fixed in pgx/v4, see: jackc/pgconn#139
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