MagicStack / MagicStack/asyncpg
AttributeError: 'NoneType' object has no attribute 'cancelled'
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
- asyncpg version: 0.14.0
- PostgreSQL version: 9.6.6
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: I can't reproduce - Python version: 3.6.4
- Platform: Alpine Linux
- Do you use pgbouncer?: Yes
- Did you install asyncpg with pip?: Yes
- If you built asyncpg locally, which version of Cython did you use?: 0.27.3
- Can the issue be reproduced under both asyncio and
uvloop?: No
Same query sometimes breaks with this, meaning the exact query other times works flawlessly, any ideas?
[06:06:23][ERROR] robbie.http.microservice.middleware.errors api.py:__call__:242 | ("Non SQL error happened: 'NoneType' object has no attribute 'cancelled'", AttributeError("'NoneType' object has no attribute 'cancelled'",))
Traceback (most recent call last):
File "robbie/sql/postgresql/utils.py", line 119, in robbie.sql.postgresql.utils.sql_exceptions_handler.wrapper
File "robbie/sql/postgresql/client.py", line 119, in fetch
File "/usr/local/lib/python3.6/site-packages/asyncpg/pool.py", line 405, in fetch
return await con.fetch(query, *args, timeout=timeout)
File "/usr/local/lib/python3.6/site-packages/asyncpg/connection.py", line 345, in fetch
return await self._execute(query, args, 0, timeout)
File "/usr/local/lib/python3.6/site-packages/asyncpg/connection.py", line 1289, in _execute
query, args, limit, timeout, return_status=return_status)
File "/usr/local/lib/python3.6/site-packages/asyncpg/connection.py", line 1297, in __execute
return await self._do_execute(query, executor, timeout)
File "/usr/local/lib/python3.6/site-packages/asyncpg/connection.py", line 1312, in _do_execute
stmt = await self._get_statement(query, timeout)
File "/usr/local/lib/python3.6/site-packages/asyncpg/connection.py", line 286, in _get_statement
statement = await self._protocol.prepare(stmt_name, query, timeout)
File "asyncpg/protocol/protocol.pyx", line 168, in prepare
File "asyncpg/protocol/coreproto.pyx", line 122, in asyncpg.protocol.protocol.CoreProtocol._read_server_messages
File "asyncpg/protocol/coreproto.pyx", line 625, in asyncpg.protocol.protocol.CoreProtocol._push_result
File "asyncpg/protocol/protocol.pyx", line 818, in asyncpg.protocol.protocol.BaseProtocol._on_result
File "asyncpg/protocol/protocol.pyx", line 745, in asyncpg.protocol.protocol.BaseProtocol._dispatch_result
AttributeError: 'NoneType' object has no attribute 'cancelled'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback through asyncpg/pool.py, connection.py, and the protocol files, focusing on the result dispatch path where cancelled is accessed. Since the report has no reproduction, first narrow down the conditions that produce the None value under asyncio and uvloop, then add a regression test showing the query completes without this AttributeError.
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
- 25/100