From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: more autovacuum fixes |
Date: | 2007-06-19 17:58:14 |
Message-ID: | 20070619175814.GC21268@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Alvaro Herrera wrote:
> One problem with the patch is this (new code):
>
> bn = (Backend *) malloc(sizeof(Backend));
> ! if (bn)
> {
> ! bn->pid = StartAutoVacWorker();
> ! bn->is_autovacuum = true;
> ! /* we don't need a cancel key */
>
> ! if (bn->pid > 0)
> ! {
> ! /* FIXME -- unchecked memory allocation here */
> ! DLAddHead(BackendList, DLNewElem(bn));
>
>
> If the palloc() inside DLNewElem fails, we will fail to report a "fork
> failure" to the launcher. I am not sure how serious this is. One idea
> that came to mind was using a PG_TRY block, sending the signal in the
> CATCH block, and then rethrowing the exception. Is this acceptable?
I noticed another problem: the worker may fail during BaseInit() or
InitProcess(). This is not where most problems will be (that would be
later, in InitPostgres(), which is when the worker connects to a DB) but
still could cause a starvation problem, I think. Maybe the PG_TRY block
is called for in there, as well as the postmaster code.
--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"The ability to monopolize a planet is insignificant
next to the power of the source"
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2007-06-19 20:02:20 | Re: more autovacuum fixes |
Previous Message | Tom Lane | 2007-06-19 17:53:17 | Re: [HACKERS] 'Waiting on lock' |