MagicStack / MagicStack/asyncpg

Something is setting the result on a completed task?

Open
#729 5 comments 0 reactions 0 assignees View on GitHub

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.22.0+ (at commit 075114c195e9eb4e81c8365d81540beefb46065c)
* **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](https://github.com/magicstack/uvloop)?**: for now I've seen this under uvloop

```Fatal error on transport TCPTransport
protocol:
transport:
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```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at asyncpg/connect_utils.py:516, where TLSUpgradeProto.data_received calls self.on_data.set_result(True), and trace when that task is completed under uvloop. Reproduce the reported InvalidStateError with CockroachDB if possible; done means the TLS upgrade no longer attempts to set a result on an already-completed task.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.