Skip to content

AWS SDK short-lived threads never get evicted #2556

@jasonjkeller

Description

@jasonjkeller

We are using the AWS SDK AsyncClient, which uses a short-lived threads (around 10 seconds lifetime).

ThreadService maintains a cache that stores all thread names by their IDs, and it is supposed to remove entries older than 5 minutes on the next read.

ThreadStateSampler samples threads every minute by default.

The problem is that the sampler retrieves all threads every minute and writes them into the cache. But when it retrieves them again a minute later, most of those threads have already terminated and been replaced with new ones, which are then written into the cache again.

As a result, short-lived threads never get evicted, because in the current implementation they don’t appear during the next retrieval cycle, so they never get a chance to be removed.

Originally posted by @Trraxxe in #2379

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions