MagicStack / MagicStack/asyncpg

connection.close is throwing protocol error

未關閉
#490 8 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
8.1k
分支
468
PR 合併指標
30 天內沒有已合併 PR

描述

asyncpg version: 0.18.1
PostgreSQL version: 9.5.10
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: using google cloud sql pg instance
Python version: 3.6.5
Platform: Ubuntu
Do you use pgbouncer?: No
Did you install asyncpg with pip?: Yes
If you built asyncpg locally, which version of Cython did you use?:
Can the issue be reproduced under both asyncio and
uvloop?: No

I have been facing this error for quite sometime intermittently asyncpg.exceptions._base.InternalClientError: got result for unknown protocol state 0

The entire stack trace:

 File "/repo/server/schema_db.py", line 345, in read
    await connection.close()

  File "/usr/local/lib/python3.6/dist-packages/asyncpg/connection.py", line 1082, in close
    await self._protocol.close(timeout)

  File "asyncpg/protocol/protocol.pyx", line 560, in close

  File "asyncpg/protocol/protocol.pyx", line 814, in asyncpg.protocol.protocol.BaseProtocol._dispatch_result

asyncpg.exceptions._base.InternalClientError: got result for unknown protocol state 0

Can someone explain when this exception is thrown and for what reason?
If i know the reason this exception is thrown, i can figure out the issue myself.
I'm not able to reproduce locally or in my stage environment.

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 schema_db.py:345 處失敗的 await connection.close() 開始,接著檢查 asyncpg/protocol/protocol.pyx 中的 close 和 BaseProtocol._dispatch_result,並使用回報的堆疊追蹤與版本詳細資訊。確定在 Google Cloud SQL PostgreSQL 執行個體上產生未知協定狀態的間歇性條件;當原因以及可靠的重現或驗證途徑確立後,該 issue 即完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
postgresql, python
領域
databases
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。