Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bug: `ydb.aio.retry_operation` retains memory on exceptions chained from Pydantic validation errors

Aperta
#905 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

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

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_operation retains 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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ydb-platform/ydb-python-sdk

Tutte le issue di ydb-platform/ydb-python-sdk

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.