MerginProject may not get cleaned up properly
還沒有人認領這個 Issue。
評估
研究方向
首先定位 MerginProject 的 pygeodiff GeoDiff 建立以及 logger-callback 設定,然後比較 mergin-db-sync PR 79 中的清理修正與相關的 geodiff issue 190。完成標準是:重複建立 MerginProject 不再保留循環參照,也不會導致資源增長,並使用重現迴圈驗證清理效果。
由索引模型根據 Issue 內容生成。
描述
When MerginProject is created, it creates geodiff object and assigns an internal logger to geodiff. This creates a cyclic reference (pygeodiff refs MerginProject, and MerginProject refs pygeodiff) that may keep resources held, which may be a problem if MerginProject object is created many times. See also fix for this in db-sync: https://github.com/MerginMaps/mergin-db-sync/pull/79
Also somehow related: https://github.com/MerginMaps/geodiff/issues/190
Code snippet to replicate the cleanup issue:
import pygeodiff
class MerginProjectX:
def __init__(self, directory):
def _logger_callback(level, text_bytes):
self.x() # not a real function, but refs this object...
self.geodiff = pygeodiff.GeoDiff()
self.geodiff.set_logger_callback(_logger_callback)
# this will keep consuming more and more resources
for i in range(50000):
print(i)
mp = MerginProjectX("x")
#mp.geodiff = None # this helps to break ref cycle
time.sleep(0.005)
- 主要語言
- Python
- 星號
- 23
- 分支
- 12
- 平均合併
- 2 天 13 小時
- 30 天內合併 PR
- 7
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
MerginMaps/python-api-client 的其他 Issue
-
Vacuuming 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
MerginMaps/python-api-client#320 ·
-
難度 5/5 一週以上 新手友好度 30/100
MerginMaps/python-api-client#270 ·
-
enhancement
難度 5/5 一週以上 新手友好度 25/100
MerginMaps/python-api-client#257 · 3 則留言 ·
-
enhancement
難度 4/5 3-5 天 新手友好度 25/100
MerginMaps/python-api-client#254 · 1 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 25/100
MerginMaps/python-api-client#245 ·
查看 MerginMaps/python-api-client 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
anthropics/skills#1811 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·