Skip to content

Dynamodb enhanced client keeps spawning sdk-ScheduledExecutor threads #3746

@vasylv1

Description

@vasylv1

Describe the bug

I use sdk v2 2.19.26 and it keeps spawning threads in a WAITING state.
Thread dump shows thousands of threads in WAITING state like this:

"sdk-ScheduledExecutor-0-0" prio=0 tid=0x0 nid=0x0 waiting on condition
java.lang.Thread.State: WAITING
on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@59b572af
at java.base@11.0.16/jdk.internal.misc.Unsafe.park(Native Method)
at java.base@11.0.16/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
at java.base@11.0.16/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081)
at java.base@11.0.16/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1177)
at java.base@11.0.16/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
at java.base@11.0.16/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
at java.base@11.0.16/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
at java.base@11.0.16/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base@11.0.16/java.lang.Thread.run(Thread.java:829)

sdk-ScheduledExecutor is defined in SdkDefaultClientBuilder in sdk2

Expected Behavior

There is no issue with threads

Current Behavior

Thread dump shows thousands of threads in WAITING state

Reproduction Steps

var dynamoDbClient = DynamoDbClient
.builder()
.region(region)
.credentialsProvider(() -> AwsBasicCredentials.create(accessKey, secretKey))
.overrideConfiguration(ClientOverrideConfiguration.builder()
.apiCallTimeout(DYNAMODB_CLIENT_TIMEOUT)
.retryPolicy(RetryPolicy.defaultRetryPolicy().toBuilder()
.numRetries(DYNAMODB_CLIENT_MAX_ERROR_RETRY)
.build())
.build())
.build();

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.19.26

JDK version used

11

Operating System and version

alpine-zulu

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions