MagicStack / MagicStack/asyncpg
asyncpg.exceptions._base.InterfaceError: cannot call Connection.fetch(): connection has been released back to the pool
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 468
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
* **asyncpg version**: 0.26.0
* **PostgreSQL version**: 12.0
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce : NO, from pg docker
the issue with a local PostgreSQL install?**: YES,
* **Python version**: Python 3.9.13
* **Platform**: MAC
* **Do you use pgbouncer?**: No
* **Did you install asyncpg with pip?**: From tortoise-orm
* **If you built asyncpg locally, which version of Cython did you use?**: No
* **Can the issue be reproduced under both asyncio and
[uvloop](https://github.com/magicstack/uvloop)?**: YES
I am using Sanic + tortoise-orm,
the test code as below:

when runs a query during the Request handler, it runs successfully
while runs in a background task, it report this error:
`asyncpg.exceptions._base.InterfaceError: cannot call Connection.fetch(): connection has been released back to the pool
`
I found when the first time query, through the pool.acquire, got the right 0x7fd3d018e550>
but when go to the background task query , the pool.acquire, got an "released"
I am confused how can I got an released PoolConnectionProxy from the same code
[query in the get Request method]

[query in the background task]

[the pool connection acquire method]

[the pool connection release method]

Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit den Sanic- und tortoise-orm-Beispielen für Request-Handler gegenüber Hintergrund-Tasks im Issue und verfolge dann die in den Screenshots gezeigten Pfade von pool.acquire und pool release. Reproduziere den Fehler mit der freigegebenen PoolConnectionProxy, wenn möglich, und ermittle, ob die Hintergrundabfrage nach der Freigabe eine Verbindung verwendet; abgeschlossen ist die Aufgabe, wenn die Ursache und entweder eine projektseitige Behebung oder ein bestätigtes Nutzungsproblem dokumentiert sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- postgresql, python
- Bereich
- backend, databases
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100