Skip to content

Sync close_client does not close the underlying boto3 HTTP session #76

Description

@dkropachev

Problem

close_client() stops the Alternator live-node manager and clears internal references, but it does not close the underlying botocore HTTP session. Boto3 clients expose a .close() method for this, and boto3 resources expose it through resource.meta.client.close().

Async cleanup already closes the underlying aiobotocore client in close_async_client(), so sync and async lifecycle behavior diverges.

Evidence

Relevant code:

  • alternator/client.py: close_client() stops the manager and clears the partition-key cache reference, then returns.
  • alternator/async_client.py: close_async_client() always calls await client.__aexit__(...) in a finally block.

A local check confirmed boto3 DynamoDB clients have .close(), while resources have .meta.client.close().

Expected behavior

close_client() / close_resource() should close the underlying botocore client transport after Alternator-specific cleanup.

Test coverage needed

Add sync lifecycle tests that use mocks or real boto3 clients to verify:

  • close_client(client) calls client.close().
  • close_client(resource) calls resource.meta.client.close().
  • cleanup remains idempotent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions