pgAdmin / pgcli could not send data to server: Socket is not connected

My setup is My home…

Login

Blog History

My setup is

My home network is IPv6 enabled. I have an AAAA record specifying the IPv6 address of the Amazon EC2 instances Elastic IP

    <IPv6 enabled home network>
                |
            <internet>
                |
<Dockerized Postgres on EC2 Instance>

Getting this error message when attempting to connect to the Postgres port on the Amazon EC2 instance

pgcli -h example.com -p 5436 -U dbuser targetdb -W
Password for dbuser:
could not send data to server: Socket is not connected
could not send SSL negotiation packet: Socket is not connected

Symptoms - Error messages

  • XTuple Postbooks
    • client taking forever (1+ minutes) to login
  • PGAdmin4 connecting to remote server and listing databases but had two errors
    • When trying to run the Query Tool:
      Transaction ID not found in the session
      could not send data to server: Socket is not send connected
      SSL negotiation packet: Socket is not connected
  • pgcli
    • could not send data to server: Socket is not connected
      could not send SSL negotiation packet: Socket is not connected

The fix

Fix 1

Connect using the IPv4 address. Hardcode the IPv4 address in pgAdmin and use it for pgcli

pgcli postgres://[email protected]:5436/dbname
pgcli -h 10.11.12.13 -p 5436 -U username dbname -W

This forces the postgres client tools to use IPv4. Working!!!

Fix 2

Add a IPv6 firewall rule to allow IPv6 Connections to the Network Security Group protecting your EC2 instance that way when pgcli or pgadmin resolves the IPv6 IP address it can connect without the above mentioned errors

If your internet provider is giving you out a /64 range then just use that to specify that your network is enabled

Specify either an IPv6 Network

2001:db8:85a3:8d3::/64

Or an individual host

2001:db8:85a3:8d3:1319:8a2e:370:7348/128

Add a rule into your Network Security Group to allow incoming IPv6 from your local network and/or host

After adding the IPv6 rule everything started working using both IPv4 address and hostname resolving to IPv6 address

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.