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:
textsoftware.amazon.awssdk.services.s3.model.S3Exception: The requested range is not satisfiable. (Service: S3, Status Code: 416)Reproduction
bash# 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
Interface
No new interfaces are introduced.
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 using command. Additionally, you can use and to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Floci version / image tag:
- Assistant
I'll start by exploring the repository structure and locating the range-request handling code mentioned in the issue.
- Assistant
Now I'll inspect
handleRangeRequestinS3Controller.java. - Assistant
Let me read the full handleRangeRequest method.
- Assistant
I'll check existing range-request tests and any notes on AWS empty-object behavior.
- Assistant
Checking project docs and nearby range-handling patterns for the intended empty-object behavior.
- Assistant
Let me look at how parse range works in S3Service for copy source range - it may have similar bugs.
- Assistant
I understand the bug: for empty objects a suffix range yields
start=0, end=-1, which is rejected. I'll fix that and check how tests are run. - Assistant
Implementing the fix: per RFC 7233, a non-zero suffix range on an empty object is satisfiable and should return empty content.
- Assistant
Removing the unused variable and switching the empty-object response to 200 OK so clients won't mis-parse
Content-Range: bytes */0. - Assistant
Fixing the corrupted javadoc text.
- Assistant
Next I'll verify
appendObjectHeadersand try compiling, then reproduce the bug with a test. - Assistant
HOME is not set, need to set it for mvnw.
- Assistant
I'll check how to start the app and run the S3 tests.
- Assistant
I'll compile the project and run the range-related S3 integration tests.
- Assistant
Ordered tests need full setup — running the complete S3IntegrationTest class.
- Assistant
Range tests passed. Creating a temporary test to verify the empty-object suffix-range fix, then removing it.
- Assistant
Temp test passed. Removing it and reviewing the final diff.
- Assistant
The fix looks good. Submitting after a quick final review of the changed method.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.