Re: Occupied port warning - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Occupied port warning
Date
Msg-id 200506301929.08050.peter_e@gmx.net
Whole thread Raw
In response to Re: Occupied port warning  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Occupied port warning
List pgsql-hackers
I wrote:
> The least thing it should do is error out if *no* TCP/IP port could
> be created while listen_addresses is set.

It's doing that now, and that should guard against the most common 
problem, namemly the port already being occupied (since all TCP/IP 
listen sockets use the same port).

Reading the comments in StreamServerPort, it seems the only problem we 
can't go fatal error everywhere is that on some systems the IPv4 and 
IPv6 sockets fight each other when bind() is called.  For the other 
failure modes, it seems that no such precautions are necessary.  In 
particular, I think we could error out in all of the following cases:

- Host or service name could not be resolved (just specify it 
numerically instead).  This would help against mistyped host names and 
misconfigured name servers.

- MaxListen exceeded (don't configure so many sockets instead).

- socket() failed

- listen() failed

I think we could also error out if we cannot create at least one listen 
socket for each entry in listen_addresses (instead of at least one 
overall).

Comments on that?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Backend working directories and absolute file paths
Next
From: Andrew Dunstan
Date:
Subject: Re: Backend working directories and absolute file paths