Skip to content

OverflowError: can't convert negative value to uint32_t #279

Closed
@eheien

Description

@eheien
  • asyncpg version: 0.15.0
  • PostgreSQL version: PostgreSQL 9.5.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16), 64-bit (AWS RDS version)
    PostgreSQL 9.5.2 on x86_64-pc-linux-gnu, compiled by gcc (Alpine 6.3.0) 6.3.0, 64-bit (local)
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : Yes, AWS RDS. Local install of PostgreSQL does not have the problem.
  • Python version: 3.6.4
  • Platform: Red Hat 4.8.5-16
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?: n/a
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : did not try
db_asyncpg.py:97: in connection_init_func
                await connection.set_type_codec('geometry', schema='public',
                                                encoder=geom_encoder_ogr, decoder=geom_decoder_ogr,
                                                format='binary')
/usr/lib64/python3.6/site-packages/asyncpg/connection.py:914: in set_type_codec
    encoder, decoder, format)
asyncpg/protocol/settings.pyx:35: in asyncpg.protocol.protocol.ConnectionSettings.add_python_codec
    ???
asyncpg/protocol/settings.pyx:56: in asyncpg.protocol.protocol.ConnectionSettings.add_python_codec
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   OverflowError: can't convert negative value to uint32_t

asyncpg/protocol/codecs/base.pyx:541: OverflowError

We constantly create and tear down test DBs, and I believe the problem is that OIDs constantly increase. With the type introspection query on namespace public and type geometry I get the following in the local DB:
7124428 0 b
and the following in the DB that has the failure:
2573727724 0 b

You can see the second OID will overflow to negative if cast as an int. I'm not sure what the solution is, but I'm pretty sure this is the cause of the failure.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions