Re: [HACKERS] ERROR: infinite recursion in proc_exit

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

> >
> > Hmm. If that trace is from 6.5 code, then postgres.c should certainly
> > be calling proc_exit after the recv() fails. I wonder if proc_exit is
> > returning because proc_exit_inprogress is nonzero? proc_exit's use of
> > elog(ERROR) does look mighty bogus to me --- that path could possibly
> > cause a recursion just like this, but how did the code get into it to
> > begin with?
>
> The proc_exit_inprogress stuff was added by me after I found some backends
> doing exactly that sort of infinite recursion after a socket recv error.
> It doesn't correct the original error but at least il will exit the backend
> after 10 iterations. The elog(ERROR) might be bogus in this context, but how
> can you otherwise notify the error? Maybe a better solution could be this:
>
> if (proc_exit_inprogress++ == 9)
> elog(ERROR, "infinite recursion in proc_exit");
> if (proc_exit_inprogress >= 9)
> goto exit;

Fix applied:

/*
* If proc_exit is called too many times something bad is happening, so
* exit immediately. This is crafted in two if's for a reason.
*/
if (proc_exit_inprogress == 9)
elog(ERROR, "infinite recursion in proc_exit");
if (proc_exit_inprogress >= 9)
goto exit;

--
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 Tom Lane 1999-11-06 17:11:49 Re: [HACKERS] Path-length follies
Previous Message Bruce Momjian 1999-11-06 16:51:49 Re: New version of psql