apache/iceberg · warning

Retrying read from S3, reopening stream

Error message

Retrying read from S3, reopening stream (attempt {})

What it means

S3InputStream registers a failover RetryPolicy for the AWS CRT/S3 client: when a read fails with a retryable exception, it logs this warning including the attempt count, resets and reopens the stream from the last known position, and retries. It indicates an S3 read was interrupted but transparently recovered; only onFailure (an error log) means the read truly failed.

Solutions

  1. No action needed for occasional retries — the stream self-heals
  2. If retries are frequent, investigate network stability or S3 endpoint/proxy settings
  3. Increase client read timeouts or reduce concurrency causing throttling
  4. Inspect the onFailure ERROR log for the terminal failure if reads actually break
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight S3 reachability before large reads
s3Client.headObject(b -> b.bucket(bucket).key(key));

Try / catch

try (InputStream in = inputFile.newStream()) { readAll(in); } // transient retries are automatic; IOException here means retries were exhausted

Prevention

When it happens

Trigger: Reading a file via S3FileIO.newInputFile().newStream() when the connection is dropped mid-read, S3 returns 5xx/timeout, or the CRT client hits transient network errors.

Common situations: Long-running scans over flaky networks; S3 throttling; large sequential reads interrupted by connection reset; short read timeouts.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/b65f523330e30e9f. Report an issue: GitHub.

Appendix: source

Thrown at aws/src/main/java/org/apache/iceberg/aws/s3/S3InputStream.java:77

  private final S3Client s3;
  private final S3URI location;
  private final S3FileIOProperties s3FileIOProperties;

  private InputStream stream;
  private long pos = 0;
  private long next = 0;
  private boolean closed = false;

  private final Counter readBytes;
  private final Counter readOperations;

  private int skipSize = 1024 * 1024;
  private RetryPolicy<Object> retryPolicy =
      RetryPolicy.builder()
          .handle(RETRYABLE_EXCEPTIONS)
          .onRetry(
              e -> {
                LOG.warn(
                    "Retrying read from S3, reopening stream (attempt {})", e.getAttemptCount());
                resetForRetry();
              })
          .onFailure(
              e ->
                  LOG.error(
                      "Failed to read from S3 input stream after exhausting all retries",
                      e.getException()))
          .withMaxRetries(3)
          .build();

  S3InputStream(S3Client s3, S3URI location) {
    this(s3, location, new S3FileIOProperties(), MetricsContext.nullMetrics());
  }

  S3InputStream(
      S3Client s3, S3URI location, S3FileIOProperties s3FileIOProperties, MetricsContext metrics) {
    this.s3 = s3;

View on GitHub (pinned to 86d9c8fc54)