Memory leak with Pool usage
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
報告されたプール引数を使って asyncpg.create_pool エントリーポイントから開始し、説明されている psutil の測定方法で、段階的なメモリ増加を再現します。プールされた接続と asyncpg の直接接続を、max_inactive_connection_lifetime の経過後、明示的なガベージコレクション後、プールのクローズ後も含めて比較します。再現によってクエリ数に関連する増加が見られなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
- asyncpg version: 0.27
- PostgreSQL version: 14
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: no - Python version: 3.8, 3.10 and 3.11
- Platform: docker images python:3.x-slim-buster
- Do you use pgbouncer?: no
- Did you install asyncpg with pip?: yes
- Can the issue be reproduced under both asyncio and
uvloop?: only asyncio
When we use a Pool, the memory usage of our process keeps increasing slowly with the number of queries. After 1000 queries, it is ~10MB and this increases with the number of queries executed on connections acquired from the pool. This remains after the max_inactive_connection_lifetime has passed with no activity, with explicit garbage collection and even after we close the pool. We can reproduce this with a psutil measurement and observe it in production. When we replace the usage of Pool with our own creation/cleanup of asynpg Connections, the issue dissapears.
Pool created with the following arguments:
asyncpg.create_pool(
max_inactive_connection_lifetime=300,
command_timeout=30,
min_size=0,
max_size=5
)
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 469
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MagicStack/asyncpg のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MagicStack/asyncpg#1357 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
MagicStack/asyncpg#1354 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
MagicStack/asyncpg#1342 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
MagicStack/asyncpg#1340 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 28/100
MagicStack/asyncpg#1337 ·
MagicStack/asyncpg の 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 ·