Re: Fix "database is ready" race condition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Markus Schiltknecht <markus(at)bluegap(dot)ch>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix "database is ready" race condition
Date: 2007-02-07 16:46:25
Message-ID: 14117.1170866785@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Markus Schiltknecht <markus(at)bluegap(dot)ch> writes:
> is there a good reason to print the "database system is ready" message
> in StartupXLOG() in xact.c? It has a) nothing to do with xlog and b)
> opens a small race condition: the message gets printed, while it still
> take some CPU cycles until the postmaster really gets the SIGCHLD signal
> and sets StartupPID = 0. If you (or rather: an automated test program)
> try to connect within this timespan, you get a "database is starting up"
> error, which clearly contradicts the "is ready" message.

I've applied a modified form of this patch. The postmaster now says
"database system is ready to accept connections" after it's finished
reacting to the completion of the startup process.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2007-02-07 16:46:58 Re: Anyone going to the LinuxWorld Summit in NYC
Previous Message Andrew Dunstan 2007-02-07 14:29:09 Re: Chatter on DROP SOMETHING IF EXISTS

Browse pgsql-patches by date

  From Date Subject
Next Message Markus Schiltknecht 2007-02-07 16:49:46 Re: Fix "database is ready" race condition
Previous Message Gregory Stark 2007-02-07 15:56:18 Re: LIMIT/SORT optimization