Skip to content

SessionPool keeps returning uninitialized sessions after it's stopped #260

@snaury

Description

@snaury

I'm using asyncio and when there's an error in one coroutine, that exception is propagated to top level and session pool is stopped. However, since I'm using asyncio.gather other coroutines are not cancelled and they keep running. However when SessionPool is stopped SessionPool.checkout keeps returning uninitialized sessions instead of raising some sensible exception, which causes all attempts to run queries with that session to fail with BadSession. This is a retriable exception, so my code keeps spinning in retries.

When using a very large number for max_retries in RetrySettings this would keep spinning until something else fails, which may be essentially never.

I think SessionPool.checkout should throw some non-retriable error when SessionPool is stopped and there is no chance to get a valid session: https://github.com/ydb-platform/ydb-python-sdk/blob/main/ydb/aio/table.py#L344

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions