Upplication / Amazon-S3-FileSystem-NIO2

An S3 File System Provider for Java 7
MIT License
122 stars 67 forks source link

SocketTimeoutException #30

Closed pditommaso closed 9 years ago

pditommaso commented 9 years ago

I got a SocketTimeoutException while reading some files attributes. I'm was wondering if someone has ever experienced this problem and if setting a higher read timeout could eventually help to avoid this error.

Here it is the error stack trace:

java.lang.RuntimeException: java.net.SocketTimeoutException: Read timed out
    at com.upplication.s3fs.util.S3ObjectSummaryLookup.getS3Object(S3ObjectSummaryLookup.java:97) ~[s3fs-0.2.8.jar:na]
    at com.upplication.s3fs.util.S3ObjectSummaryLookup.getS3Object(S3ObjectSummaryLookup.java:63) ~[s3fs-0.2.8.jar:na]
    at com.upplication.s3fs.util.S3ObjectSummaryLookup.lookup(S3ObjectSummaryLookup.java:24) ~[s3fs-0.2.8.jar:na]
    at com.upplication.s3fs.S3FileSystemProvider.readAttributes(S3FileSystemProvider.java:482) ~[s3fs-0.2.8.jar:na]
    at java.nio.file.Files.readAttributes(Files.java:1686) ~[na:1.7.0_75]
    at nextflow.util.CacheHelper.hashFileMetadata(CacheHelper.java:199) ~[nxf-commons-0.13.0-SNAPSHOT.jar:na]
     (.. omitted ..)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_75]
    at java.net.SocketInputStream.read(SocketInputStream.java:152) ~[na:1.7.0_75]
    at java.net.SocketInputStream.read(SocketInputStream.java:122) ~[na:1.7.0_75]
    at sun.security.ssl.InputRecord.readFully(InputRecord.java:442) ~[na:1.7.0_75]
    at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:554) ~[na:1.7.0_75]
    at sun.security.ssl.InputRecord.read(InputRecord.java:509) ~[na:1.7.0_75]
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934) ~[na:1.7.0_75]
    at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:891) ~[na:1.7.0_75]
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:102) ~[na:1.7.0_75]
    at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:204) ~[httpcore-4.2.jar:4.2]
    at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:182) ~[httpcore-4.2.jar:4.2]
    at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:204) ~[httpcore-4.2.jar:4.2]
    at org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:108) ~[httpcore-4.2.jar:4.2]
    at org.apache.http.conn.BasicManagedEntity.streamClosed(BasicManagedEntity.java:157) ~[httpclient-4.2.jar:4.2]
    at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:237) ~[httpclient-4.2.jar:4.2]
    at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:186) ~[httpclient-4.2.jar:4.2]
    at java.io.FilterInputStream.close(FilterInputStream.java:181) ~[na:1.7.0_75]
    at com.upplication.s3fs.util.S3ObjectSummaryLookup.getS3Object(S3ObjectSummaryLookup.java:86) ~[s3fs-0.2.8.jar:na]
    ... 61 common frames omitted
jarnaiz commented 9 years ago

I am not sure.. eventually I got this error, but i supose that is a internet problem or amazon AWS problem. I use this library to upload files to amazon and download it in production, and I am not getting these problems.

pditommaso commented 9 years ago

I think the same, it could have been a network hiccup. However I think it could be useful having the ability to tune the connection timeout and max retry. I saw you are using the AWS ClientConfiguration defaults.

I would propose to have in the lib some configuration properties to override the ClientConfiguration defaults.

Also since that exception is thrown on the close method invocation, maybe that exception could be catched and reported just a warning.

What do you think?

erizocosmico commented 9 years ago

@pditommaso I think the ability to cange the ClientConfiguration would be awesome. I also think reporting a warn is more useful than throwing an exception since there's nothing you can do to fix it and generates noise in the logs.

jarnaiz commented 9 years ago

You can change the settings with the new version. Check out the readme.