question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'NoneType' object has no attribute 'cancelled'

See original GitHub issue
  • 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'

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
thehesiodcommented, Oct 22, 2021

I just hit this w/ copy_from_query and it reminded me of https://github.com/MagicStack/asyncpg/issues/726 (which is an asyncio bug), so I tried w/ uvloop and that seems to fix the problem as well.

1reaction
yohanbonifacecommented, Dec 14, 2021

FYI, I have the same issue (using copy_from_table) on a server running python 3.8, but not in local running python 3.9 or 3.10. And I confirm that using uvloop works around the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get AttributeError: 'NoneType' object has no attribute ...
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None .
Read more >
'NoneType' object has no attribute 'cancel' with Calibre
The root cause being that Python 3.8.3 is now making abstract socket namespaces playing nice with multiprocess, obsoleting Calibre's dirty hack to work...
Read more >
1840290 – Calibre fails to start - AttributeError: 'NoneType ...
Bug 1840290 - Calibre fails to start - AttributeError: 'NoneType' object has no attribute 'cancel'. Summary: Calibre fails to start - AttributeError: ...
Read more >
Bug report #10669: Processing - AttributeError NoneType ...
QDialogButtonBox.Cancel).setEnabled(False) AttributeError: 'NoneType' object has no attribute 'setEnabled' Python version: 2.7.3 (default, Feb 27 2014, ...
Read more >
AttributeError: 'NoneType' object has no attribute 'call' on ...
AttributeError : 'NoneType' object has no attribute 'call' on sync_portal ... Hello, I'm at a loss to explain why this flow fails and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found