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.

0.22.0 - object of type 'asyncpg.pgproto.pgproto.WriteBuffer' has no len()

See original GitHub issue
  • asyncpg version: 0.22.0
  • PostgreSQL version: 11
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?:
  • Python version: CPython 3.8.1
  • Platform: Ubuntu 18.04
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: pipenv
  • If you built asyncpg locally, which version of Cython did you use?: n/a
  • Can the issue be reproduced under both asyncio and uvloop?: Running under uvloop

After having upgraded our underlying asyncpg version from 0.21.0 to 0.22.0 two days ago, every ~12 hours our http service has been running into an issue at which it can no longer connect to the database without restarting. The issue being reported is

StopIteration: null
  File "asyncpg/protocol/coreproto.pyx", line 945, in asyncpg.protocol.protocol.CoreProtocol._bind_execute_many_more
    buf = <WriteBuffer>next(self._execute_iter)

TypeError: object of type 'asyncpg.pgproto.pgproto.WriteBuffer' has no len()
  File "asyncpg/protocol/protocol.pyx", line 909, in asyncpg.protocol.protocol.BaseProtocol._writelines
    self.transport.writelines(buffers)
  File "uvloop/sslproto.pyx", line 163, in uvloop.loop._SSLProtocolTransport.writelines
    self._ssl_protocol._write_appdata(list_of_data, self.context.copy())
  File "uvloop/sslproto.pyx", line 652, in uvloop.loop.SSLProtocol._write_appdata
    self._write_buffer_size += len(data)

For context, we use tortoise-orm to interface with asyncpg.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Gyllsdorffcommented, Mar 18, 2021

@fantix

Do you know when the fix for this will be release? Is this a warning log or does it mean that sql commands are failing?

0reactions
fantixcommented, Mar 9, 2021

https://github.com/MagicStack/py-pgproto/blob/126bcd24bd3c59d581613dae026e2721efbedf16/buffer.pxd#L28 Shouldn’t this be __len__?

That’s indeed the issue I think. Though I’m not sure if we want to pass over the WriterBuffer directly to the transport - wrapping into a memoryview probably makes more sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A brand new website interface for an even better experience!
0.22.0 - object of type 'asyncpg.pgproto.pgproto.WriteBuffer' has no len()
Read more >
API Reference — asyncpg Documentation
Returns a new Connection object. Parameters. dsn –. Connection arguments specified using as a single string in the libpq connection URI format: postgres://user ......
Read more >
asyncpg · PyPI
asyncpg is a database interface library designed specifically for PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL ...
Read more >
tiangolo/fastapi - 'UUID' object has no attribute 'replace' - Gitter
the data = dict(obj) fails with e: 'UUID' object has no attribute 'replace' then ... https://magicstack.github.io/asyncpg/current/usage.html#type-conversion.
Read more >
0.22.0 - object of type 'asyncpg.pgproto.pgproto.WriteBuffer' has no ...
0.22.0 - object of type 'asyncpg.pgproto.pgproto.WriteBuffer' has no len() - Python asyncpg. asyncpg version: 0.22.0; PostgreSQL version: 11 ...
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