Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng
#905 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
50/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

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().

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Python
Star
102
Fork
77
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ydb-platform/ydb-python-sdk

Tất cả issue của ydb-platform/ydb-python-sdk

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.