Skip to content

fix: prevent Instance plugin Items list mutation on each run() cycle#233

Open
ky0uraku wants to merge 1 commit into
postgrespro:masterfrom
ky0uraku:fix/instance-list-mutation
Open

fix: prevent Instance plugin Items list mutation on each run() cycle#233
ky0uraku wants to merge 1 commit into
postgrespro:masterfrom
ky0uraku:fix/instance-list-mutation

Conversation

@ky0uraku

Copy link
Copy Markdown

Методы run() и keys_and_queries() в instance.py используют all_items = self.Items, что создаёт ссылку на список класса, а затем += self.Items_pg_12 мутирует его на месте через list.iadd. Из-за этого self.Items постоянно растёт на len(Items_pg_12) + len(Items_pg_18) элементов при каждом цикле сбора, вызывая утечку памяти.

Исправление: использовать self.Items.copy() для создания нового списка на каждом вызове — аналогично фиксу плагина Statements в v3.5.2 (#187).

Исправляет #232

Methods run() and keys_and_queries() in instance.py used
'all_items = self.Items' which binds to the class-level list, then
'+= self.Items_pg_12' mutates it in place via list.__iadd__.
This caused self.Items to grow by len(Items_pg_12) + len(Items_pg_18)
elements on every collection cycle (~60s), eventually exceeding
PostgreSQL's MaxTupleAttributeNumber limit (1664 columns).

Fix: use self.Items.copy() to create a new list each time,
identical to the fix applied to Statements plugin in v3.5.2 (postgrespro#187).

Fixes postgrespro#232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant