ISSUE DESCRIPTION [BUG] S3 GetObject suffix range fails for empty objects Service S3 AWS…
- User
ISSUE DESCRIPTION
[BUG] S3 GetObject suffix range fails for empty objects
Service
S3
AWS API Action
GetObject with the
Rangeheader set to a suffix byte range, for examplebytes=-1.Expected behavior
A suffix range request against an existing empty object should not fail the read. This is exercised by Trino's S3 filesystem compatibility test for empty files, where
TrinoInput.readTail(...)reads an existing zero-byte S3 object and expects an empty successful read.Actual behavior
Floci returns
416 InvalidRangefor the same request becauseS3Controller.handleRangeRequestcomputesstart = 0andend = -1for an empty object, then rejects the range.In Trino's Floci-backed S3 filesystem test this surfaces as:
software.amazon.awssdk.services.s3.model.S3Exception: The requested range is not satisfiable. (Service: S3, Status Code: 416)Reproduction
# Start Floci on localhost:4566 first. aws --endpoint-url http://localhost:4566 s3 mb s3://range-empty-repro printf '' > /tmp/empty-object aws --endpoint-url http://localhost:4566 s3 cp /tmp/empty-object s3://range-empty-repro/empty aws --endpoint-url http://localhost:4566 s3api get-object \ --bucket range-empty-repro \ --key empty \ --range 'bytes=-1' \ /tmp/range-empty-outputEnvironment
- Floci version / image tag:
floci/floci:1.5.21 - Java SDK version (if applicable): observed with Trino's AWS SDK v2 S3 client tests
- How you're running Floci (Docker / native /
mvn quarkus:dev): Docker via Testcontainers
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it uses to get the changes that need to be submitted. - Floci version / image tag:
- Assistant
I’ll locate the S3 range handling and its tests, reproduce or reason through the empty-object suffix path, then make the smallest behavior-compatible fix and run targeted tests plus relevant build checks.
- Assistant
The failure is exactly in the suffix branch: for zero length it derives
(start,end)=(0,-1), then the common validation rejects it. I’ll preserve 416 behavior for malformed and genuinely unsatisfiable ranges, while treating a valid positive suffix request on an empty object as a successful empty partial response. I’ll avoid inventing an invalid byte interval inContent-Range; the response will retain the object metadata and zero content length. - Assistant
The first edit command could not run because this environment has no
python3; no repository files were changed. I’ll apply the same targeted edit using the available shell tools. - Assistant
Compilation passes. The targeted S3 integration suite ran 98 tests; all range-related tests passed, with one unrelated pre-existing failure in non-ASCII copy-object handling (400 vs 200). I’ll run the range tests alone and inspect the final diff/status before submission.
- Assistant
The method-filtered run is not a valid targeted result here: Surefire did not execute the shared test setup, so every request returned 404. The full
S3IntegrationTestrun did execute setup and its existing range cases passed. The only modified file is the controller, and the diff is whitespace-clean. I’m submitting this focused fix now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.