Re: [HACKERS] ERROR: infinite recursion in proc_exit

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>, PostgreSQL Hackers <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] ERROR: infinite recursion in proc_exit
Date: 1999-11-06 19:45:37
Message-ID: 199911061945.OAA04497@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> That isn't going to make things any better, because it's still laboring
> under the same basic oversight: elog(ERROR) does not return to the
> caller, it returns control to the main loop. Thus, having proc_exit
> call elog(ERROR) is simply *guaranteed* to create a failure. proc_exit
> must not allow control to return anywhere, under any circumstances,
> because it is used as the final recourse when things are too screwed up
> to consider continuing.

Massimo pointed out some problems in my fix. The new code is:

if (++proc_exit_inprogress == 9)
elog(ERROR, "infinite recursion in proc_exit");
if (proc_exit_inprogress >= 9)
goto exit;

/* ----------------
* if proc_exit_inprocess > 1, then it means that we
* are being invoked from within an on_exit() handler
* and so we return immediately to avoid recursion.
* ----------------
*/
if (proc_exit_inprogress > 1)
return;

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kristofer Munn 1999-11-06 20:09:54 Arrays broken on temp tables
Previous Message Tom Lane 1999-11-06 18:08:13 Re: [HACKERS] ERROR: infinite recursion in proc_exit