Re: [HACKERS] unchecked out of memory in postmaster.c

2009-05-03 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > Tom Lane wrote: > >> If you're really intent on doing something about this, my inclination > >> would be to get rid of the dependence on DLNewElem altogether. Add > >> a Dlelem field to the Backend struct and use DLInitElem (compare > >> the way catcac

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-05-03 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> If you're really intent on doing something about this, my inclination >> would be to get rid of the dependence on DLNewElem altogether. Add >> a Dlelem field to the Backend struct and use DLInitElem (compare >> the way catcache uses that module). > Hmm

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> If you're really intent on doing something about this, my inclination >> would be to get rid of the dependence on DLNewElem altogether. Add >> a Dlelem field to the Backend struct and use DLInitElem (compare >> the way catcache uses that module). > Hmm

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > Tom Lane wrote: > >> I guess I need to point out that those ereport calls already pose a far > >> more substantial risk of palloc failure than the DLNewElem represents. > > > Hmm, do they? I mean, don't they use ErrorContext, which is supposed to > >

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> I guess I need to point out that those ereport calls already pose a far >> more substantial risk of palloc failure than the DLNewElem represents. > Hmm, do they? I mean, don't they use ErrorContext, which is supposed to > be preallocated? Well, we'd l

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > I think a patch to solve this is as simple as the attached. > > I guess I need to point out that those ereport calls already pose a far > more substantial risk of palloc failure than the DLNewElem represents. Hmm, do they? I mean, don't they use Erro

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Tom Lane
Alvaro Herrera writes: > I think a patch to solve this is as simple as the attached. I guess I need to point out that those ereport calls already pose a far more substantial risk of palloc failure than the DLNewElem represents. You seem to have forgotten about releasing the DLElem if the fork fa

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > Some time ago I noticed that in postmaster.c there's a corner case which > > probably causes postmaster to exit in out-of-memory condition. See > > BackendStartup, near the bottom, there's a call to DLNewElem(). The > > problem is that this function c

Re: [HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Tom Lane
Alvaro Herrera writes: > Some time ago I noticed that in postmaster.c there's a corner case which > probably causes postmaster to exit in out-of-memory condition. See > BackendStartup, near the bottom, there's a call to DLNewElem(). The > problem is that this function calls palloc() and thus can

[HACKERS] unchecked out of memory in postmaster.c

2009-04-06 Thread Alvaro Herrera
Hi, Some time ago I noticed that in postmaster.c there's a corner case which probably causes postmaster to exit in out-of-memory condition. See BackendStartup, near the bottom, there's a call to DLNewElem(). The problem is that this function calls palloc() and thus can elog(ERROR) on OOM, but po