From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: duplicate connection failure messages |
Date: | 2010-10-14 05:30:36 |
Message-ID: | AANLkTikrYV2BPV=2UY7OYkOoJsQjs3EQKYeH_tdU4rbU@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Oct 13, 2010 at 21:21, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> This surprised me:
>
> psql -p 55555 -h localhost
> psql: could not connect to server: Connection refused
> Is the server running on host "localhost" and accepting
> TCP/IP connections on port 55555?
> could not connect to server: Connection refused
> Is the server running on host "localhost" and accepting
> TCP/IP connections on port 55555?
>
> It shows the same error message twice. I can reproduce this back to PG
> 8.2.
>
> It appears to have something to do with localhost resolving to an IPv4
> and an IPv6 address, since it doesn't happen with other host names that
> only resolve to one address. However, fe-connect.c claims:
>
> /*
> * Try to initiate a connection to one of the addresses
> * returned by pg_getaddrinfo_all(). conn->addr_cur is the
> * next one to try. We fail when we run out of addresses
> * (reporting the error returned for the *last* alternative,
> * which may not be what users expect :-().
> */
That comment is out of date. I implemented the "keep all error
messages and append them to each other" feature to make sure it didn't
throw away the interesting error message and replaced it with a
generic one later, must've missed that comment - at least it should be
changed. And I agree it's not very friendly in this specific case - I
wonder if we should log it as "localhost (127.0.0.1) and "localhost
(::1)" (and similar for any other case that returns more than one
address).
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Itagaki Takahiro | 2010-10-14 06:25:49 | Re: string function - "format" function proposal |
Previous Message | Fujii Masao | 2010-10-14 05:11:31 | Bug in writeTimeLineHistory |