bug: `ydb.aio.retry_operation` retains memory on exceptions chained from Pydantic validation errors
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 50/100
Direzione di ricerca
Start at the ydb.aio.retry_operation entry point and build the reported Python 3.12/Pydantic 2.13.4 reproduction, comparing it with directly awaiting the coroutine. Trace the retry result, application exception, ValidationError, traceback, and coroutine references; done means otherwise-unreferenced locals are collectible after handling the exception and running gc.collect().
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Report
Coroutine-local objects remain alive after ydb.aio.retry_operation propagates an application exception chained from a Pydantic ValidationError, even after the caller handles the exception and explicitly runs gc.collect(). No database connection is required to reproduce this.
YDB Python SDK version:
version 3.31.4
Environment
Environment: Python 3.12, Pydantic 2.13.4, pydantic-core 2.46.4.
Current behavior:
- Directly awaiting the same coroutine releases its local objects.
- Calling it through
ydb.aio.retry_operationretains them. - A simple application exception without the validation-error cause did not reproduce the retention.
The observed reference chain is:
YdbRetryOperationFinalResult
→ application exception
→ Pydantic ValidationError
→ traceback
→ coroutine frame and local objects
Possible Pydantic-specific interaction: the reproduction uses a union of custom validators that raise ValueError. Pydantic can retain these underlying exceptions as validation-error context, potentially adding traceback references to the retry-state cycle. Its native implementation may be relevant to why the objects survive garbage collection, but this mechanism has not been established.
Expected behavior:
Once the operation has failed and the caller has handled the exception, otherwise-unreferenced coroutine locals should be collectible.
Steps to reproduce:
- Create a coroutine that allocates a local object and triggers a Pydantic validation error using a union of failing custom validators.
- Raise an application exception chained from that ValidationError.
- Compare directly awaiting the coroutine with calling it through ydb.aio.retry_operation.
- Handle the exception, run garbage collection, and check the local object through a weak reference.
- In the tested reproduction, the direct call released the object, while the SDK retry call retained it.
- Lingua principale
- Python
- Stelle
- 102
- Fork
- 77
- Merge medio
- 2g 17h
- PR unite (30g)
- 10
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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.
Altre issue di ydb-platform/ydb-python-sdk
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ydb-platform/ydb-python-sdk#290 ·
I maintainer di solito rispondono entro 1 giorno
-
dev: Forbid imports relativeApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
ydb-platform/ydb-python-sdk#897 ·
I maintainer di solito rispondono entro 1 giorno
-
dev: improve codebase documentationForse già presa @Khabib73 l’ha presa 16 giorni fa. Apertaenhancement
ydb-platform/ydb-python-sdk#895 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
dev: Refactor legacyApertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
ydb-platform/ydb-python-sdk#884 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ydb-platform/ydb-python-sdk#876 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ydb-platform/ydb-python-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
solana-foundation/pay-kit#341 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nasa/python_cmr#123 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
EleutherAI/lm-evaluation-harness#4243 ·
I maintainer di solito rispondono entro 1 giorno
-
area: dashboard bug perceived difficulty: 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
cusp-ai-oss/tojax#17 ·