Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[leo_gateway] Cannot get an object with range #376

Closed
yosukehara opened this issue Jun 5, 2015 · 5 comments
Closed

[leo_gateway] Cannot get an object with range #376

yosukehara opened this issue Jun 5, 2015 · 5 comments

Comments

@yosukehara
Copy link
Member

I've received this issue as below:

I found another related problem. I use aws-java-sdk-s3 access Leofs V1.2.10. When getting object with range, the client sdk throws an AmazonClientException.

S3Object s3Object = s3Client.getObject(new GetObjectRequest(ConfigProps.S3_BUKET, objectKey)
                .withRange(0, 3));

Exception in thread "main" com.amazonaws.AmazonClientException: More data read than expected: dataLength=4; expectedLength=0; includeSkipped=true; in.getClass()=class com.amazonaws.services.s3.AmazonS3Client$2; markedSupported=false; marked=0; resetSinceLastMarked=false; markCount=0; resetCount=0
    at com.amazonaws.util.LengthCheckInputStream.checkLength(LengthCheckInputStream.java:155)
    at com.amazonaws.util.LengthCheckInputStream.read(LengthCheckInputStream.java:110)
    at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:73)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
    at java.io.InputStreamReader.read(InputStreamReader.java:184)
    at java.io.BufferedReader.fill(BufferedReader.java:154)
    at java.io.BufferedReader.readLine(BufferedReader.java:317)
    at java.io.BufferedReader.readLine(BufferedReader.java:382)
    at com.lenovo.leoss.client.Utils.displayTextInputStream(Utils.java:43)
    at com.lenovo.leoss.client.Main.main(Main.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

It seems the aws-java-sdk-s3 need a content-length header in response, but leofs used chunked transfer encoding.

@mocchira
Copy link
Member

mocchira commented Jun 5, 2015

I remembered that S3 doesn't respond http responses with transfer-encoding:chunked.

#153 (comment)

We always need to respond with content-length when handling GET requests.

@yosukehara yosukehara added this to the 1.2.11 milestone Jun 5, 2015
@yosukehara yosukehara self-assigned this Jun 5, 2015
@yosukehara
Copy link
Member Author

@mocchira Thank you for sharing the info. I'll check that.

@windkit
Copy link
Contributor

windkit commented Jun 5, 2015

Looking into the issue, hope I can propose a pull request this weekend

@yosukehara
Copy link
Member Author

@windkit I'm waiting for your request 👍

@yosukehara
Copy link
Member Author

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

No branches or pull requests

3 participants