#8208·rustfs

`ListObjectParts` returns `NextPartNumberMarker` even when `IsTruncated=false`, causing an infinite loop in AWS SDK paginators

Author: antoine-rouxCreated Sep 28, 2026Updated Sep 29, 2026
LabelsS-reproducing

Supported storage confirmation

  • I have reproduced this issue with all RustFS data directories on supported storage (local disks, SAN/Fibre Channel, or JBOD; XFS recommended), without NFS, SMB/Samba/CIFS, or other remote or shared filesystem mounts, including storage backing Docker volumes and Kubernetes PersistentVolumes.

Describe the bug

ListObjectParts always emits <NextPartNumberMarker>0</NextPartNumberMarker> even when IsTruncated=false. The AWS S3 spec only returns NextPartNumberMarker when IsTruncated=true. Because the AWS SDK for JavaScript v3 paginateListParts paginator uses NextPartNumberMarker as its continuation token, and the deserialized value is the string "0" (truthy), the paginator computes hasNext = true forever. This causes an infinite loop of ListObjectParts requests on the same upload, which never completes the multipart upload and floods the server with log output.

Steps to reproduce

javascript
const {
  S3Client,
  CreateMultipartUploadCommand,
  UploadPartCommand,
  ListPartsCommand,
  paginateListParts,
} = require('@aws-sdk/client-s3');

const c = new S3Client({
  endpoint: 'http://<rustfs-host>:9000',
  region: 'us-east-1',
  forcePathStyle: true,
  credentials: { accessKeyId: '<AK>', secretAccessKey: '<SK>' },
  requestChecksumCalculation: 'WHEN_REQUIRED',
  responseChecksumValidation: 'WHEN_REQUIRED',
});

const { UploadId } = await c.send(
  new CreateMultipartUploadCommand({ Bucket: 'b', Key: 'k' }),
);
await c.send(
  new UploadPartCommand({ Bucket: 'b', Key: 'k', UploadId, PartNumber: 1, Body: Buffer.alloc(1024) }),
);

// Single call — shows the malformed response:
const lp = await c.send(
  new ListPartsCommand({ Bucket: 'b', Key: 'k', UploadId, MaxParts: 1000 }),
);
console.log(lp.IsTruncated, lp.NextPartNumberMarker, typeof lp.NextPartNumberMarker);
// → false "0" string

// The paginator never terminates (cap it or it hangs):
for await (const page of paginateListParts({ client: c }, { Bucket: 'b', Key: 'k', UploadId })) {
  // ...
}

Observed output of the single call: IsTruncated=false NextPartNumberMarker="0" type=string. The paginateListParts loop must be interrupted (e.g., after a few pages / a timeout).

Expected behavior

When IsTruncated=false, the response must omit NextPartNumberMarker. The AWS SDK paginator then sees no continuation token and terminates after one page.

RustFS version

rustfs/rustfs:latest@sha256:8cc9801755448b71a786705ce76692c77e14936cccd87cf2fc31842e58f4d1ff

Deployment method

Docker / Docker Compose

Data directory filesystems and mounts

RustFS runs in Docker (Docker Swarm). The data directory inside the container is /data, backed by a host bind mount ./s3_data (relative to the stack directory). findmnt -T on the host backing path:

$ findmnt -T /[redacted]/s3_data -o TARGET,SOURCE,FSTYPE,OPTIONS
TARGET  SOURCE  FSTYPE  OPTIONS
/[redacted]  /dev/sdX btrfs   rw,relatime,discard=async,space_cache=v2,subvolid=5,subvol=/
  • Data directory host path: /[redacted]/s3_data (owned by uid 10001)
  • Log directory host path: /[redacted]/s3_logs (owned by uid 10001)
  • Backing filesystem: btrfs on /dev/sdX

Server operating system and architecture

Ubuntu 24.04.4 LTS (Linux 6.8.0-107-generic) x86_64

Client environment

  • LobeHub web application; uploading a 170 MB .flac audio file (> 64 MB triggers multipart upload)
  • AWS SDK for JavaScript v3 @aws-sdk/client-s3 ~3.932.0 (bundled in the LobeHub server)
  • LobeHub calls paginateListParts inside completeMultipartUpload to re-list and validate part sizes

Relevant logs

bash
Sanitized excerpt from the rustfs log (INFO level, `RUSTFS_OBS_LOGGER_LEVEL=info`) during the loop — a single upload_id repeated tens of thousands of times, always requesting page 0:


{"level":"INFO","name":"list_object_parts","bucket":"xxx","object":"files/<id>/<uuid>.flac","part_number_marker":"Some(0)","max_parts":1000,"upload_id":"<redacted>","target":"rustfs_ecstore::store"}
{"level":"INFO","name":"list_object_parts","bucket":"xxx","object":"files/<id>/<uuid>.flac","part_number_marker":"Some(0)","max_parts":1000,"upload_id":"<redacted>","target":"rustfs_ecstore::store::multipart"}


Observed stats: **~57,500 `list_object_parts` requests for a single upload in ~52 seconds**, all at `part_number_marker: Some(0)` (plus a few `None` for the initial page), producing multiple GB of logs per hour and high CPU.

Screenshots

No response

Additional context

  • Deployment topology: Docker Swarm, rustfs single node behind a Traefik reverse proxy. LobeHub is the main consumer.
  • The bug is triggered on every multipart upload (file > 64 MB) because LobeHub's completeMultipartUpload calls paginateListParts; the upload never completes and the request hangs until the client aborts.
  • Root cause: ListPartsInfo.next_part_number_marker is a non-optional usize (default 0) and is only assigned when the response is truncated; the S3 serializer then emits it unconditionally (res.next_part_number_marker.try_into().ok() → Some(0)).
  • Introduced in 44f3eb724 (2025-09-05, "Fix: add support for additional AWS S3 storage classes and validation logic (#487)"), which added is_truncated: Some(res.is_truncated) and next_part_number_marker: res.next_part_number_marker.try_into().ok() to the ListPartsOutput. The list_parts API itself was added in a9d77a618 (2025-07-15) but initially left these fields as None.

Fix (applied & verified)

Emit NextPartNumberMarker only when IsTruncated=true, matching AWS S3. Three files changed:

  1. crates/storage-api/src/multipart.rs — make the field optional:
    rust
    pub next_part_number_marker: Option<usize>,
  2. crates/ecstore/src/set_disk/ops/multipart.rs — only set it when truncated (no unwrap_or_default, stays None otherwise):
    rust
    if object_parts.len() > ret.parts.len() {
        ret.is_truncated = true;
        ret.next_part_number_marker = ret.parts.last().map(|v| v.part_num);
    }
  3. rustfs/src/storage/s3_api/multipart.rs — serialize it only when present:
    rust
    next_part_number_marker: res.next_part_number_marker.and_then(|v| v.try_into().ok()),

This makes NextPartNumberMarker absent when IsTruncated=false, which lets the AWS SDK paginator terminate normally.

Patch: rustfs-listobjectparts-pagination-fix.patch