Skip to content

S3 Clients are leaving behind open PIPE file descriptors #5306

@dyutishb

Description

@dyutishb

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:

S3AsyncClient s3AsyncClient = S3AsyncClient.crtBuilder()
                                           .credentialsProvider(credentialsProvider)
                                           .region(Region.US_EAST_1)
                                           .build();
S3TransferManager s3TransferManager = S3TransferManager.builder()
                                                       .s3Client(s3AsyncClient)
                                                       .build();

We also have S3Client, StsClient and S3Presigner being setup similarly and we do an explicit .close() on each of them. Irrespective of the close() being called any file handles opened due to the clients should be garbage collected on destruction of the object which is not happening.
The same is not seen with the v1 SDK.

Expected Behavior

Any file descriptors opened due to operations by the sdk should be garbage collected when the clients are destroyed.

Current Behavior

Pipe and a_inode file descriptors being left behind even after closing on the clients.

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 request is completed. Compare the open file descriptors before and after the request using sudo lsof -p <pid> or sudo ls -l /proc/<pid>/fd.

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.crt-clientneeds-reviewThis issue or PR needs review from the team.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions