- Newest
- Most votes
- Most comments
The "Connection reset by peer" error you're experiencing with S3 tables is likely due to network connectivity issues between your application and the S3 service. This error occurs when the TCP connection is unexpectedly terminated by the remote server.
There are several potential causes and workarounds for this issue:
-
Idle Connection Timeout: VPC Endpoints, including those for S3, have a fixed idle timeout of 350 seconds (about 5.8 minutes). After this period of inactivity, the connection is terminated, which can lead to the "Connection reset by peer" error.
-
TCP Keepalive Configuration: By default, many systems have TCP Keepalive configured to trigger after 7200 seconds (2 hours), which might be too long for maintaining connections to S3.
Possible workarounds include:
- Implement TCP Keepalive: Configure your application or operating system to use TCP Keepalive with more aggressive settings:
- Set
tcp_keepalive_timeto around 300 seconds (5 minutes) - Set
tcp_keepalive_intvlto 60 seconds - Set
tcp_keepalive_probesto 5
-
Implement Application-Level Keepalive: Periodically send small requests to S3 to keep the connection active.
-
Add Retry Logic: Implement robust retry mechanisms in your application to handle connection resets gracefully. When a reset occurs, re-establish the connection and resume the operation.
-
Use AWS SDK: If you're not already using it, the AWS SDK provides built-in retry mechanisms and can handle many connection issues automatically.
-
Check Concurrency Settings: If you're making many concurrent connections, you might need to increase the
fs.s3.maxConnectionsvalue to accommodate your application's concurrency needs.
Since this is happening only with specific tables, also check if those tables have different characteristics (size, access patterns, etc.) that might be triggering the issue.
Sources
Network issue to S3: Timeouts in S3? | AWS re:Post
OpenSSL SSL_read: Connection reset by peer, errno 104 | AWS re:Post
Relevant content
- asked 9 months ago
- asked 9 months ago
