MagicStack / MagicStack/asyncpg
connection.close is throwing protocol error
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the failing await connection.close() at schema_db.py:345, then inspect asyncpg/protocol/protocol.pyx at close and BaseProtocol._dispatch_result, using the reported stack trace and version details. Determine the intermittent conditions that produce the unknown protocol state with the Google Cloud SQL PostgreSQL instance; the issue is done when the cause and a reliable reproduction or verification path are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100