Odd listen_addresses behavior

Started by Joshua D. Drakealmost 9 years ago3 messages
#1Joshua D. Drake
jd@commandprompt.com

-hackers,

I found this today:

jd@jd-wks:~/snap/postgresql96/common/data$
/snap/postgresql96/19/usr/bin/pg_ctl -D data stop
pg_ctl: directory "data" does not exist

jd@jd-wks:~/snap/postgresql96/common/data$ cd ..

jd@jd-wks:~/snap/postgresql96/common$
/snap/postgresql96/19/usr/bin/pg_ctl -D data stop
waiting for server to shut down...LOG: received fast shutdown request
.LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
done
server stopped

jd@jd-wks:~/snap/postgresql96/common$ grep listen_addresses
data/postgresql.conf
listen_addresses = '192*' # what IP address(es) to listen on;

-- I wasn't actually expecting the above to work. I was just testing.

jd@jd-wks:~/snap/postgresql96/common$
/snap/postgresql96/19/usr/bin/pg_ctl -D data start
server starting

jd@jd-wks:~/snap/postgresql96/common$ postgresql96.psql -U jd -h
localhost postgres
psql (9.6.2)
Type "help" for help.

postgres=# show listen_addresses ;
listen_addresses
------------------
*
(1 row)

I grant that this is obscure but perhaps we should do something about it?

Thanks,

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joshua D. Drake (#1)
Re: Odd listen_addresses behavior

"Joshua D. Drake" <jd@commandprompt.com> writes:

jd@jd-wks:~/snap/postgresql96/common$ grep listen_addresses
data/postgresql.conf
listen_addresses = '192*' # what IP address(es) to listen on;

-- I wasn't actually expecting the above to work. I was just testing.

Fails as expected for me:

$ postgres --listen-addresses='192*'
2017-03-15 15:50:11.024 EDT [3852] LOG: could not translate host name "192*", service "5432" to address: Name or service not known
2017-03-15 15:50:11.024 EDT [3852] WARNING: could not create listen socket for "192*"
2017-03-15 15:50:11.024 EDT [3852] FATAL: could not create any TCP/IP sockets
2017-03-15 15:50:11.024 EDT [3852] LOG: database system is shut down

postgres=# show listen_addresses ;
listen_addresses
------------------
*
(1 row)

I'm suspicious that you have an override of listen_addresses somewhere ---
for instance, the "-i" postmaster command line switch effectively is
--listen-addresses='*'. Even if you had a version of getnameinfo() that
failed to complain about '192*', that would not cause the recorded value
of the string GUC to silently transmogrify into something else. You might
look into pg_settings to see where it says that value of listen_addresses
came from.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Joshua D. Drake
jd@commandprompt.com
In reply to: Tom Lane (#2)
Re: Odd listen_addresses behavior

On 03/15/2017 12:57 PM, Tom Lane wrote:

I'm suspicious that you have an override of listen_addresses somewhere ---
for instance, the "-i" postmaster command line switch effectively is
--listen-addresses='*'.

Yep.... postgresql.auto.conf.

Thanks, sorry for the noise.

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers