Re: Occupied port warning

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Occupied port warning
Date: 2005-06-30 17:29:07
Message-ID: 200506301929.08050.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2005-06-30 18:20:22 Re: Backend working directories and absolute file paths
Previous Message David Fetter 2005-06-30 17:16:32 Re: Backend working directories and absolute file paths