MagicStack / MagicStack/asyncpg
Infinite hang on leaving conn.transaction() block
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
Hi, I am experiencing hangs at aexit of Transaction context manager, with traceback as follows:
...
File "/usr/local/lib/python3.7/dist-packages/asyncpg/transaction.py", line 89, in __aexit__
await self.__rollback()
File "/usr/local/lib/python3.7/dist-packages/asyncpg/transaction.py", line 198, in __rollback
await self._connection.execute(query)
File "/code/callmeback/detail/log_helpers/postgre_conn.py", line 53, in execute
return await super(LoggingConn, self).execute(query, *args, timeout=timeout)
File "/usr/local/lib/python3.7/dist-packages/asyncpg/connection.py", line 273, in execute
return await self._protocol.query(query, timeout)
Default command timeout is set for connection:
>>> conn = frame.f_locals['self']
>>> conn._config
ConnectionConfiguration(command_timeout=10.0, statement_cache_size=100, max_cached_statement_lifetime=300, max_cacheable_statement_size=15360)
>>> conn._protocol._get_timeout(None)
10.0
So I expect self._protocol.query() to throw TimeoutError of some kind, but related coroutine hanged for three days with no progress.
I will happily provide you with any additional information, if I can. My app has aiomonitor onboard, so if any info reachable that way will help you - please let me know.
I tried to fiddle with conn._protocol, but almost nothing of its state is reachable from aioconsole since it's Cython.
My suspection is that exception that leads to rollback is coming from in-transaction query that somehow leads connection in such a state that rollback() cannot be processed normally. I will provide you with information about exception once that problem triggers next time.
- asyncpg version: 0.18.3
- PostgreSQL version: 10.7
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: - Python version: 3.7
- Platform: Ubuntu 16.04
- Do you use pgbouncer?: Yes (session-level pooling)
- Did you install asyncpg with pip?: Yes
- If you built asyncpg locally, which version of Cython did you use?: --
- Can the issue be reproduced under both asyncio and
uvloop?: Yes, I am using uvloop
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 da asyncpg/transaction.py, in aexit e rollback, quindi segui connection.py execute() fino a _protocol.query(). Riproduci il blocco, se possibile, con PostgreSQL 10.7, il pooling a livello di sessione di pgbouncer e uvloop; il lavoro è completato quando il percorso di rollback termina oppure restituisce il timeout configurato invece di rimanere bloccato.
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
- 35/100