Re: Occupied port warning - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Occupied port warning
Date
Msg-id 14965.1119968655@sss.pgh.pa.us
Whole thread Raw
In response to Occupied port warning  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Occupied port warning
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> During a recent training session I was reminded about a peculiar 
> misbehavior that recent PostgreSQL releases exhibit when the TCP port 
> they are trying to bind to is occupied:

> LOG:  could not bind IPv4 socket: Address already in use
> HINT:  Is another postmaster already running on port 5432? If not, wait 
> a few seconds and retry.
> WARNING:  could not create listen socket for "localhost"

> The trainees found this behavior somewhat unuseful.

What behavior are you proposing, exactly?

I don't think it's practical to make the server error out if it can't
bind to every socket it tries to bind to --- that will leave you dead
in the water in an uncomfortably large number of scenarios.  I think
the cases that forced us to adopt this behavior originally were ones
where userland thinks IPv6 is supported but the kernel does not.
Thus, we can *not* treat the list returned by getaddrinfo as gospel.

It might be reasonable to treat some error conditions as fatal but
not others.  But you'd have to engage in pretty close analysis to
make sure you weren't buying into any bad behaviors.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Implementing SQL/PSM for PG 8.2 - debugger
Next
From: Tom Lane
Date:
Subject: Re: #ifdef NOT_USED