aws-doc-sdk-examples icon indicating copy to clipboard operation
aws-doc-sdk-examples copied to clipboard

[Bug]: Using SDK for Java 2.x Upload stream of unknown size not close "AwsEventLoop" thread.

Open brunoyuri1 opened this issue 1 year ago • 0 comments

Expected behavior

After send data using the stream to S3, the AwsEventLoop thread need to be close to free resources.

Actual behavior

Following the example provided at Amazon S3 User Guide, I successfully uploaded a stream of unknown size to Amazon S3. However, upon analyzing the process with VisualVM, I observed that the internal threads created by the AWS SDK do not close after the upload completes. Specifically, the threads labeled 'AwsEventLoop' continue to run indefinitely.

I am concerned because I am creating a web application using Spring that will send several files via stream to S3, and over time, if the threads are not released, it could cause memory issues

Screenshot 2024-05-07 214012

Steps to reproduce

1. Create an application capable of sending a stream of data to Amazon S3. Use the provided example as a reference:: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/s3/src/main/java/com/example/s3/async/PutObjectFromStreamAsync.java
2. Ensure the application can send multiple streams concurrently or sequentially.
3. Utilize VisualVM to monitor the application's threads. It has been observed that the AwsEventLoop threads do not terminate upon completion of their tasks. Attempting to send additional files results in the creation of new threads, leading to potential resource allocation issues as resources are not being released.

Logs / stacktrace (if applicable)

No response

Which SDK were you using?

Java (v2)

Which OS were you using?

Windows

SDK version

2.25.23

OS version

Windows 11

brunoyuri1 avatar May 08 '24 01:05 brunoyuri1