Skip to content

Use of a class variable thread causes severe delays/issues #1039

@nils-dohop

Description

@nils-dohop

Describe the bug

The SlidingExpirationCacheWithCleanupThread as used in the custom_endpoint_plugin.py, specifically here:

_monitors: ClassVar[SlidingExpirationCacheWithCleanupThread[str, CustomEndpointMonitor]] = \

causes long delays during process shutdown as it essentially behaves like a global variable. It would be best to do explicit lifecycle handling of this object.

Expected Behavior

No severe delays/issues just from importing the aws-advanced-connection-wrapper.

What plugins are used? What other connection properties were set?

rds, iam

Current Behavior

The library caused severe delays when shutting down the service.

Reproduction Steps

Load the library without actually using it in any code, then wait for the process to terminate.

Possible Solution

Add explicit lifetime handling of the thread, ensure it isn't instantiated at load time but is tied to the lifecycle of the connection wrapper object.

Additional Information/Context

No response

The AWS Advanced Python Wrapper version used

1.4.0

python version used

3.13

Operating System and version

Ubuntu Linux 25.04

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