Re: Memory leak in WAL sender with pgoutput (v10~)
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>, Amit Kapila <amit.kapila16@gmail.com>
Date: 2024-11-30T08:28:31Z
Lists: pgsql-hackers
Attachments
- 0001-untested-try-at-fixing-memleak.patch (text/x-diff)
On 2024-Nov-30, Michael Paquier wrote: > After sleeping on that, and because the leak is minimal, I'm thinking > about just applying the fix only on HEAD and call it a day. This > changes the structure of Publication so as we use a char[NAMEDATALEN] > rather than a char*, avoiding the pstrdup(), for the publication name > and free it in the list_free_deep() when reloading the list of > publications. I'm not sure about your proposed fix. Isn't it simpler to have another memory context which we can reset instead of doing list_free_deep()? It doesn't have to be a global memory context -- since this is not reentrant and not referenced anywhere else, it can be a simple static variable in that block, as in the attached. I ran the stock tests (no sysbench) and at least it doesn't crash. This should be easily backpatchable also, since there's no ABI change. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
Commits
-
Fix memory leak in pgoutput with relation attribute map
- a786cf04df76 13.19 landed
- c53d90bb47ae 14.16 landed
- da8bd5d424e0 15.11 landed
- e3a27fd06d06 16.7 landed
- 836435424ba8 17.3 landed
- c9b3d4909bbf 18.0 landed
-
Fix memory leak in pgoutput with publication list cache
- ba230ce40faa 13.19 landed
- cfd6cbcf9be0 14.16 landed
- 6c9b3975407d 15.11 landed
- 4d45e7490c41 16.7 landed
- bbe68c13abe0 17.3 landed
- f0c569d71515 18.0 landed
-
Allow specifying row filters for logical replication of tables.
- 52e4f0cd472d 15.0 cited