| From: | Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com> | 
|---|---|
| To: | Daniel Gustafsson <daniel(at)yesql(dot)se> | 
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: Out of memory error handling in frontend code | 
| Date: | 2023-10-06 07:04:33 | 
| Message-ID: | 5a3058d1-1810-5a72-c50e-18df2de56fdf@dalibo.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi Daniel,
Thank you for your answer.
On 9/28/23 14:02, Daniel Gustafsson wrote:
>> On 28 Sep 2023, at 10:14, Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com> wrote:
> 
>> After some time, we understood that the 20 million of large objects were responsible for the huge memory usage (more than 10 GB) by pg_dump.
> 
> This sounds like a known issue [0] which has been reported several times, and
> one we should get around to fixing sometime.
>
Indeed, I saw some of these reports afterwards :)
>> I think a more useful error message would help for such cases.
> 
> Knowing that this is case that pops up, I agree that we could do better around
> the messaging here.
> 
>> I haven't try to get the patch ready for review, I know that the format of the messages isn't right, I'd like to know what do you think of the idea, first.
> 
> I don't think adding more details is a bad idea, but it shouldn't require any
> knowledge about internals so I think messages like the one below needs to be
> reworded to be more helpful.
> 
> +	if (loinfo == NULL)
> +	{
> +		pg_fatal("getLOs: out of memory");
> +	}
> 
OK, here is a second version of the patch.
I didn't try to fix the path getLOs -> AssignDumpId -> catalogid_insert 
-> [...] -> catalogid_allocate, but that's annoying because it amounts 
to 11% of the memory allocations from valgrind's output.
Best regards,
Frédéric
| Attachment | Content-Type | Size | 
|---|---|---|
| 0001-pg_dump-fix-OOM-handling_v2.patch | text/x-patch | 6.9 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2023-10-06 07:05:38 | Re: How to update unicode mapping table? | 
| Previous Message | Shlok Kyal | 2023-10-06 06:58:32 | Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows |