Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is setting the result on a completed task? #729

Open
ale-dd opened this issue Mar 29, 2021 · 2 comments · May be fixed by #1117
Open

Something is setting the result on a completed task? #729

ale-dd opened this issue Mar 29, 2021 · 2 comments · May be fixed by #1117

Comments

@ale-dd
Copy link

ale-dd commented Mar 29, 2021

  • asyncpg version: 0.22.0+ (at commit 075114c)
  • PostgreSQL version: CockroachDB v20.2.3
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : not a SaaS, we do our own deployments
  • Python version: Python 3.9.1
  • Platform: Linux
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: yes but from the git repo, to get the latest fixes
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : for now I've seen this under uvloop
protocol: <asyncpg.connect_utils.TLSUpgradeProto object at 0x7f3f453f9340>
transport: <TCPTransport closed=False reading=False 0x556958f834a0>
Traceback (most recent call last):
  File "uvloop/handles/stream.pyx", line 829, in uvloop.loop.__uv_stream_on_read_impl
  File "/root/aurora-extract/src/asyncpg/asyncpg/connect_utils.py", line 516, in data_received
    self.on_data.set_result(True)
asyncio.exceptions.InvalidStateError: invalid state```

@mecampbellsoup
Copy link

mecampbellsoup commented Jan 31, 2023

Also seeing this, and also under uvloop.

w-miller added a commit to w-miller/asyncpg that referenced this issue Jan 30, 2024
In the case of a misbehaving server, the client may receive more than
one byte in separate data_received() invocations from the server. While
we can't do much sane with this, we should handle it gracefully and not
crash with asyncio.InvalidStateError when trying to set another result
on the event.

Fixes MagicStack#729
w-miller added a commit to w-miller/asyncpg that referenced this issue Feb 1, 2024
In the case of a misbehaving server, the client may receive more than
one byte in separate data_received() invocations from the server. While
we can't do much sane with this, we should handle it gracefully and not
crash with asyncio.InvalidStateError when trying to set another result
on the event.

Fixes MagicStack#729
w-miller added a commit to w-miller/asyncpg that referenced this issue Feb 1, 2024
In the case of a misbehaving server, the client may receive more than
one byte in separate data_received() invocations from the server. While
we can't do much sane with this, we should handle it gracefully and not
crash with asyncio.InvalidStateError when trying to set another result
on the event.

Fixes MagicStack#729
@w-miller
Copy link

w-miller commented Feb 2, 2024

I've created a PR to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants