Re: What is happening on buildfarm member baiji? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: What is happening on buildfarm member baiji?
Date
Msg-id 12053.1179156520@sss.pgh.pa.us
Whole thread Raw
In response to Re: What is happening on buildfarm member baiji?  (Magnus Hagander <magnus@hagander.net>)
Responses Re: What is happening on buildfarm member baiji?  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> +         sprintf(mutexName,"postgresql.interlock.%i", portNumber);

That won't do; it should be legal for two postmasters to listen on
different IP addresses using the same port number.  So you need to
include some representation of the IP address being bound to.

> +         if (GetLastError() == ERROR_ALREADY_EXISTS)
> +             ereport(FATAL,
> +                     (errcode(ERRCODE_LOCK_FILE_EXISTS),
> +                      errmsg("interlock mutex \"%s\" already exists", mutexName),
> +                      errhint("Is another postgres listening on port %i", portNumber)));

ereport(FATAL) is quite inappropriate here.  Do the same thing that
bind() failure would do, ie, ereport(LOG) and continue the loop.
Also, you probably need to think about cleaning up the mutex in
case one of the later steps of socket-acquisition fails.  We should
only be holding locks on addresses we've successfully bound.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: What is happening on buildfarm member baiji?
Next
From: Gregory Stark
Date:
Subject: Re: What is happening on buildfarm member baiji?