aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.16k stars 840 forks source link

Unclosed pipe/a_inode file descriptors when using AWS SDK V2 #5304

Closed dyutishb closed 3 months ago

dyutishb commented 3 months ago

Describe the bug

We are using the aws v2 sdk on of our processes which ran out of file descriptors which led us to investigate the open ones. We can see new FDs being added and not closed even if we do simple headBucket calls to s3. Example of open FDs added:

java    6320 root  182u  a_inode               0,14         0      1057 [eventpoll:183]
java    6320 root  183r     FIFO               0,13       0t0    275505 pipe
java    6320 root  184w     FIFO               0,13       0t0    275505 pipe
java    6320 root  185u  a_inode               0,14         0      1057 [eventpoll:186]
java    6320 root  186r     FIFO               0,13       0t0    275506 pipe
java    6320 root  187w     FIFO               0,13       0t0    275506 pipe
java    6320 root  188u  a_inode               0,14         0      1057 [eventpoll:189]
java    6320 root  189r     FIFO               0,13       0t0    275507 pipe
java    6320 root  190w     FIFO               0,13       0t0    275507 pipe

Here's how we are building our client:

S3ClientBuilder s3ClientBuilder = S3Client.builder()
                    .credentialsProvider(credentialsProvider)
                    .httpClientBuilder(ApacheHttpClient.builder()
                                                       .connectionTimeout(Duration.ofMillis(CLOUD_ADAPTER_CONNECTION_SETUP_TIMEOUT_MILLIS))
                                                       .socketTimeout(Duration.ofMillis(CLOUD_ADAPTER_SOCKET_TIMEOUT_MILLIS)))
                    .forcePathStyle(pathStyleAccess)
                    .crossRegionAccessEnabled(true);

The same is not seen with the v1 SDK.

Expected Behavior

The file descriptors created by any operation should be closed when the operation completes.

Current Behavior

New FDs being added and not closed on every request.

Reproduction Steps

Create any process (imagine an api server which makes request to s3) which instantiates a s3 client and makes some basic requests like headBucket, keep the process up even after the reuqest is completed. Compare the open file descriptors before and after the request using sudo lsof -p <pid> or sudo ls -l /proc/<pid>/fd. There should be no new open FDs added due to a request.

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.25.26

JDK version used

openjdk version "1.8.0_402"

Operating System and version

Rocky Linux release 9.4 (Blue Onyx)

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.