Skip to content

SeaweedFS S3 endpoint (TLS) drops large streaming GET responses, breaking CDI http-import of large images #3782

Closed

Description

@IvanHunters

What happened

When a VMDisk (or any CDI DataVolume with source.http) points at a large object served from a provisioned Bucket's S3 endpoint, the CDI importer fails partway through the download:

Unable to write file from dataReader: stream error: stream ID 3; INTERNAL_ERROR; received from peer
failed to pull image: ... Unable to transfer source data to scratch space

The importer retries and CrashLoops; the import never completes.

Root cause

The SeaweedFS S3 gateway (port 8333, TLS) aborts large streaming GET responses after ~25-40 MB (non-deterministic). Reproduced directly against the ClusterIP from inside the cluster (no ingress involved), same client, comparing layers:

Source Full streaming GET of an ~840 MB object
seaweedfs-filer:8888 (plain HTTP, file API) full object, stable
seaweedfs-s3:8333 (HTTPS, S3 API) aborts at ~25-40 MB, OpenSSL SSL_read: unexpected eof while reading
seaweedfs-s3:8333 over plain HTTP HTTP 400 (endpoint is TLS-only)

Notes:

Impact

Any CDI http-import of a large image (VM disk images, etc.) from a Bucket's S3 URL fails. Small objects (< ~25 MB) import fine, which masks the problem until real images are used.

Environment

  • Cozystack v1.6.1-rc.1
  • seaweedfs chart 4.31.0 (weed version 4.31)
  • CDI v1.64.0

Steps to reproduce

  1. Create a Bucket; upload a large (~800 MB) object.
  2. From any in-cluster pod: curl -k https://seaweedfs-s3.<ns>.svc:8333/<bucket>/<object> -o /dev/null -> aborts with SSL unexpected EOF after tens of MB.
  3. Same object via filer: curl http://seaweedfs-filer.<ns>.svc:8888/buckets/<bucket>/<object> -o /dev/null -> completes.

Workaround

Serve large objects through the filer HTTP API (8888) instead of the S3 endpoint (8333). Range-based clients are unaffected.

Activity

  1. self-assigned this
    on Aug 12, 2026
  2. scooby87 commented on Oct 8, 2026

    @scooby87
    Contributor

    Root cause found, and it is not TLS.

    The S3 gateway is OOM-killed in the middle of the response. Its pod runs with a 512Mi memory limit (the t1.small preset in packages/extra/seaweedfs), and serving one large object makes it buffer far more than that:

    • SeaweedFS prefetches chunks ahead of a sequential reader, meant to stay four chunks ahead. ReaderCache.MaybeCache counts only the downloads it newly starts toward that window, and ChunkReadAt.ReadAt calls it after every read. The S3 handler reads 256 KiB at a time out of 4 MiB chunks, so each read pushes the window four chunks further, until the ReaderCache limit of 256 downloaders. One full GET of an 840 MiB object left about 830 MiB of chunk buffers live in the gateway's heap.
    • The response therefore stops 10 to 40 MB in, at a different offset each time, with unexpected eof over HTTP/1.1 or INTERNAL_ERROR over HTTP/2. The read-ahead cannot run past the end of the requested bytes, so small objects and moderate Range requests stay under the limit, which is why they work. The filer endpoint streams through a different code path, which is why it works too. TLS has nothing to do with it.

    Reproduced on a test cluster with an isolated SeaweedFS and the production S3 limits (512Mi, 1 CPU), an 840 MiB object uploaded through S3 multipart:

    Gateway Full GET result Pod status
    4.31, 4.45, 4.48 unpatched cut off after 11 to 40 MB, every time OOMKilled
    4.45 with GOMEMLIMIT=400MiB cut off after 12 to 13 MB OOMKilled
    4.48 with -readerCacheSizeMB=256 completes, but about 12 times slower; the gateway re-fetched about 40 times the data it sent running
    4.48 with the fix below 9 of 9 complete, checksums match, about 120 MiB of memory running

    Upgrading SeaweedFS does not fix it: the defect is on upstream master as of today.

    Until that lands, the workaround from the description still holds: fetch large objects through the filer HTTP API, or use Range requests.

  3. scooby87 commented on Oct 14, 2026

    @scooby87
    Contributor

    Fixed by #4819 (in-tree SeaweedFS build carrying the upstream read-ahead fix, seaweedfs/seaweedfs#11674). Ships in the next release after v1.7.0-rc.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triage/acceptedIndicates an issue is ready to be actively worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions