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
-
bug
难度 2/5 1-3 小时 新手友好度 90/100
learningequality/ricecooker#747 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 76/100
run-llama/llama_index#23199 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
KhronosGroup/glTF-Blender-IO#2769 ·