Skip to content

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

Merged
mstyushin merged 1 commit into
postgrespro:devfrom
ky0uraku:fix/instance-list-mutation
Jul 22, 2026
Merged

fix: prevent Instance plugin Items list mutation on each run() cycle#233
mstyushin merged 1 commit into
postgrespro:devfrom
ky0uraku:fix/instance-list-mutation

Conversation

@ky0uraku

Copy link
Copy Markdown
Contributor

Методы 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
@Kmortyk
Kmortyk changed the base branch from master to dev July 21, 2026 13:03
@mstyushin mstyushin added the bug label Jul 22, 2026
@mstyushin
mstyushin self-requested a review July 22, 2026 07:21

@mstyushin mstyushin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@mstyushin
mstyushin merged commit 99f8c2d into postgrespro:dev Jul 22, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants