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

2009-05-03 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-05-03 Thread Alvaro Herrera
Tom Lane wrote: Alvaro Herrera alvhe...@commandprompt.com 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

[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

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

2009-04-06 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-04-06 Thread Alvaro Herrera
Tom Lane wrote: Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-04-06 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-04-06 Thread Alvaro Herrera
Tom Lane wrote: Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-04-06 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-04-06 Thread Alvaro Herrera
Tom Lane wrote: Alvaro Herrera alvhe...@commandprompt.com 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

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

2009-04-06 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com 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