Re: Occupied port warning

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Occupied port warning
Date: 2005-06-28 14:24:15
Message-ID: 14965.1119968655@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-28 14:35:43 Re: commit_delay, siblings
Previous Message Tom Lane 2005-06-28 14:17:07 Re: #ifdef NOT_USED