From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel J. Summers <daniel.lists@djs-consulting.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Ubuntu 10.04 - Cannot Create TCP/IP Sockets
Date: Tue, 04 May 2010 10:24:27 -0400
Message-ID: <11068.1272983067@sss.pgh.pa.us> (raw)
In-Reply-To: <4BDFA003.2080706@djs-consulting.com>
References: <4BDE46F4.4070401@djs-consulting.com>
<1CA7FF980DA3824F9A5C31532B7A40DCCDCE01FD@LCXCLMB01.LCDS.LOC.GOV>
<4BDEC707.1090403@gmail.com>
<14337.1272894755@sss.pgh.pa.us>
<4BDED7E2.5060304@djs-consulting.com>
<15098.1272896449@sss.pgh.pa.us>
<4BDFA003.2080706@djs-consulting.com>
"Daniel J. Summers" <daniel.lists@djs-consulting.com> writes:
> On 05/03/2010 02:20 PM, Tom Lane wrote:
>> OK, what about 127.0.0.1? Given that "dig localhost" returns that,
>> it *should* behave the same, but obviously something here is not
>> behaving as expected. Also, after you start it with '*', does
>> "psql -h localhost" work?
> Yes on both accounts. When I had 127.0.0.1 or *, it both started up,
> and psql -h localhost gave me a password prompt.
Huh. Well, there seems to be no other possible conclusion except that
getaddrinfo() is returning something valid for "127.0.0.1" but not
for "localhost". And it's not failing outright for "localhost", but
returning a sockaddr that bind() won't actually accept.
I'm guessing that there's some sort of IPv4-vs-IPv6 confusion
involved here, but it's hard to say more.
We might be able to learn something if you strace the postmaster
while it's trying to start up with "localhost" as the setting.
There will be a lot of output, so send it to a file. Look for
the bind() calls --- on my Linux box the relevant part of the
trace looks like this:
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(5432), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
listen(3, 208) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(4, {sa_family=AF_INET, sin_port=htons(5432), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
listen(4, 208) = 0
getppid() = 12399
open("/tmp/.s.PGSQL.5432.lock", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
write(5, "12400\n/var/lib/pgsql/data"..., 33) = 33
close(5) = 0
unlink("/tmp/.s.PGSQL.5432") = -1 ENOENT (No such file or directory)
socket(PF_FILE, SOCK_STREAM, 0) = 5
bind(5, {sa_family=AF_FILE, path="/tmp/.s.PGSQL.5432"}, 110) = 0
chmod("/tmp/.s.PGSQL.5432", 0777) = 0
listen(5, 208) = 0
which shows the postmaster opening up both IPv6 and IPv4 sockets
as well as a Unix-domain socket in /tmp.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, daniel.lists@djs-consulting.com
Subject: Re: Ubuntu 10.04 - Cannot Create TCP/IP Sockets
In-Reply-To: <11068.1272983067@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox