bug: `ydb.aio.retry_operation` retains memory on exceptions chained from Pydantic validation errors
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
Línea de trabajo
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().
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 102
- Forks
- 77
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 11
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ydb-platform/ydb-python-sdk
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ydb-platform/ydb-python-sdk#290 ·
Los mantenedores suelen responder en 1 día
-
dev: Forbid imports relativeAbiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
ydb-platform/ydb-python-sdk#897 ·
Los mantenedores suelen responder en 1 día
-
dev: improve codebase documentationPosiblemente ocupada @Khabib73 la tomó hace 18 días. Abiertoenhancement
ydb-platform/ydb-python-sdk#895 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
dev: Refactor legacyAbiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
ydb-platform/ydb-python-sdk#884 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
feature: [SSO] support OIDC authAbiertoenhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
ydb-platform/ydb-python-sdk#876 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ydb-platform/ydb-python-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-2 días Aptitud para principiantes 70/100
-
FingerprintSplitter raises ZeroDivisionError when int(frac_train * len(dataset)) floors to zeroAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 7 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
lmstudio-ai/mlx-engine#376 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pyiron/bagofholding#166 ·