MagicStack / MagicStack/asyncpg
asyncpg.exceptions._base.InterfaceError: cannot call Connection.fetch(): connection has been released back to the pool
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 8.1k
- Fork
- 468
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
- 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?: 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 <PoolConnectionProxy <asyncpg.connection.Connection object at 0x7fd42102f9e0> 0x7fd3d018e550>
but when go to the background task query , the pool.acquire, got an "released" <PoolConnectionProxy [released] 0x7fd3d018e550>
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]

Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con gli esempi di Sanic e tortoise-orm relativi al gestore delle richieste rispetto all’attività in background nell’issue, quindi segui i percorsi di pool.acquire e pool release mostrati negli screenshot. Riproduci, se possibile, l’errore PoolConnectionProxy rilasciato e determina se la query in background utilizza una connessione dopo il rilascio; il lavoro è completato quando sono documentati la causa e una correzione lato progetto oppure un problema di utilizzo confermato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- postgresql, python
- Ambito
- backend, databases
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100