Re: memory leak in pgoutput
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: by Yang <mobile.yang@outlook.com>
Cc: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2024-11-21T06:25:09Z
Lists: pgsql-hackers
On Wed, Nov 20, 2024 at 10:41:50AM +0000, by Yang wrote: > I apologize for the obvious error in the previous patch. I have corrected it > in the new patch(v3) and pass the regression testing. It took me quite a bit of time to evaluate the amount of the damage, and indeed sysbench has been quite good at showing the problem. It is not that much though depending on the number of tables. With map laptop and 500 tables, the cleanup of the slots showed up in sudden burts that increased the memory footprint of the WAL sender. I think that there is at least one more leak, which is even smaller than the one you have reported here. It takes a longer run time to show up with sysbench, but it's here with the WAL sender memory growing slowly over time. We should be much more careful with this area of the code in terms of memory handling. Perhaps with a broader memory context associated to the data of the cached entries, reset each time an entry is validated? This current coding style is quite dangerous to rely on. Anyway, this patch fixes a portion of the damage and Hou's method was a bit cleaner, so I have used it and applied it down to v15. -- Michael
Commits
-
Fix memory leak in pgoutput for the WAL sender
- 6fc30c24cb7f 15.11 landed
- e749eaf46e9b 16.7 landed
- afe9b0d9fee1 17.3 landed
- ea792bfd93ab 18.0 landed