Re: SnapBuildSerialize function forgot pfree variable ondisk_c
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: 范孝剑(康贤) <funnyxj.fxj@alibaba-inc.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Date: 2021-01-12T13:42:34Z
Lists: pgsql-bugs
Attachments
- v1-0001-Fix-memory-leak-in-SnapBuildSerialize.patch (application/octet-stream) patch v1-0001
On Fri, Nov 13, 2020 at 11:36 AM 范孝剑(康贤) <funnyxj.fxj@alibaba-inc.com> wrote:
>
> If we create logical slot frequently, every time when creating a logical slot, it will generate a LogStandbySnapshot wal record.
>
> Session A:
> do language plpgsql $$
> declare
> v_text text := 'a';
> begin
> for i in 1..290000 loop
> execute $_$select pg_create_logical_replication_slot('logical_slot4', 'test_decoding')$_$;
> execute $_$select pg_drop_replication_slot('logical_slot4')$_$;
> end loop;
> exception when others then
> raise notice 'execute failed.';
> end;
> $$;
>
> Session B:
> pg_recvlogical -d postgres --start -S test -f test.log
>
Thanks for sharing the test. I am able to reproduce the issue and the
attached fixes it for me. This needs to be backpatched till 9.5 where
it was introduced. I am planning to push this tomorrow.
--
With Regards,
Amit Kapila.
Commits
-
Fix memory leak in SnapBuildSerialize.
- 4bccceaa9179 9.5.25 landed
- f2b268ee0626 9.6.21 landed
- 636b6f99c215 10.16 landed
- 7adc408f4b64 11.11 landed
- 0b2ae3c928b2 12.6 landed
- 0685c5c1b922 13.2 landed
- ee1b38f65948 14.0 landed