fix: prevent Instance plugin Items list mutation on each run() cycle#233
Open
ky0uraku wants to merge 1 commit into
Open
fix: prevent Instance plugin Items list mutation on each run() cycle#233ky0uraku wants to merge 1 commit into
ky0uraku wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Методы
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