From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Tatsuo Ishii <ishii(at)postgresql(dot)org>, robertmhaas(at)gmail(dot)com, kondo(at)sraoss(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::') |
Date: | 2015-10-23 02:59:27 |
Message-ID: | 55164.1445569167@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Noah Misch <noah(at)leadboat(dot)com> writes:
> On Thu, Oct 22, 2015 at 04:15:10PM -0700, Tom Lane wrote:
>> I continue to think
>> that the OP's complaint is somehow founded on a bad address obtained by
>> looking up "localhost", because where else would it've come from?
> pg_ctl reads the address from postmaster.pid, which in turn derives from
> listen_addresses:
> $ grep -E '(unix|listen)' postgresql.conf
> listen_addresses = '0.0.0.0'
> unix_socket_directories = ''
Hmm, now I see. I was about to object that that's a pretty silly setting,
but I see that we actually document it as supported.
> $ strace -e connect pg_ctl -D . -w start
> --- SIGCHLD (Child exited) @ 0 (0) ---
> waiting for server to start...connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
> connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
> connect(3, {sa_family=AF_INET, sin_port=htons(6432), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EINPROGRESS (Operation now in progress)
> 403978 2015-10-23 00:45:06.677 GMT LOG: redirecting log output to logging collector process
> 403978 2015-10-23 00:45:06.677 GMT HINT: Future log output will appear in directory "..".
> done
> server started
> Process 403975 detached
... although this trace appears to show pg_ctl working just fine with this
setting, which kinda weakens your theory. Still, it wouldn't be the first
thing we've seen fail on Windows but work elsewhere.
I'd be inclined to suggest fixing it like this:
/* If postmaster is listening on "*", use localhost */
- if (strcmp(host_str, "*") == 0)
+ if (strcmp(host_str, "*") == 0 ||
+ strcmp(host_str, "0.0.0.0") == 0 ||
+ strcmp(host_str, "::") == 0)
strcpy(host_str, "localhost");
which covers the cases we document as supported.
A different line of thought would be to teach the postmaster to record
actually bound-to addresses in postgresql.conf, rather than regurgitating
the listen_addresses setting verbatim. That would likely be a lot harder
(and less portable); though if we think there's anything besides pg_ctl
looking at this field, it might be worth trying.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | yozh.ne | 2015-10-23 10:03:39 | BUG #13708: strange behaviour instead of syntax error |
Previous Message | Felipe Gasper | 2015-10-23 01:30:20 | Re: BUG #13702: pg_dump interprets “=” in a db name incorrectly |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2015-10-23 03:16:26 | Re: Making tab-complete.c easier to maintain |
Previous Message | Robert Haas | 2015-10-23 02:00:57 | Re: shm_mq fix for non-blocking mode |