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

Upload files to S3 fails #277

Closed
hetang-shah opened this issue Apr 6, 2017 · 2 comments
Closed

Upload files to S3 fails #277

hetang-shah opened this issue Apr 6, 2017 · 2 comments

Comments

@hetang-shah
Copy link

still getting this error. Any pointer for this

com.amazonaws.AmazonClientException: Unable to execute HTTP request: Write error: ssl=0x7f1dce3400: I/O error during system call, Connection reset by peer
                                                                                                         at com.amazonaws.http.AmazonHttpClient.executeHelper(Unknown Source)
                                                                                                         at com.amazonaws.http.AmazonHttpClient.execute(Unknown Source)
                                                                                                         at com.amazonaws.services.s3.AmazonS3Client.invoke(Unknown Source)
                                                                                                         at com.amazonaws.services.s3.AmazonS3Client.putObject(Unknown Source)
                                                                                                         at com.fivestars.mma.promotions.services.CreatePromotionIntentService$onHandleIntent$1$1$1.subscribe(Unknown Source)
                                                                                                         at io.b.e.e.b.c.a(Unknown Source)
                                                                                                         at io.b.f.b(Unknown Source)
                                                                                                         at io.b.e.e.b.h$b.a(Unknown Source)
                                                                                                         at io.b.e.e.b.h$b.a_(Unknown Source)
                                                                                                         at io.b.e.e.b.l$a.f(Unknown Source)
                                                                                                         at io.b.e.e.b.l$a.run(Unknown Source)
                                                                                                         at io.b.e.g.f.run(Unknown Source)
                                                                                                         at io.b.e.g.f.call(Unknown Source)
                                                                                                         at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
                                                                                                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                                                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                                                         at java.lang.Thread.run(Thread.java:762)
                                                                                                      Caused by: javax.net.ssl.SSLException: Write error: ssl=0x7f1dce3400: I/O error during system call, Connection reset by peer
                                                                                                         at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
                                                                                                         at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:824)
                                                                                                         at com.android.okhttp.okio.Okio$1.write(Okio.java:81)
                                                                                                         at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
                                                                                                         at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
                                                                                                         at com.android.okhttp.okio.RealBufferedSink.write(RealBufferedSink.java:46)
                                                                                                         at com.android.okhttp.internal.http.HttpConnection$FixedLengthSink.write(HttpConnection.java:350)
                                                                                                         at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
                                                                                                         at com.android.okhttp.okio.RealBufferedSink$1.write(RealBufferedSink.java:198)
                                                                                                         at com.amazonaws.http.UrlHttpClient.write(Unknown Source)
                                                                                                         at com.amazonaws.http.UrlHttpClient.writeContentToConnection(Unknown Source)
                                                                                                         at com.amazonaws.http.UrlHttpClient.execute(Unknown Source)
                                                                                                         at com.amazonaws.http.AmazonHttpClient.executeHelper(Unknown Source)

code:

val clientConfiguration = ClientConfiguration()
// Timeout for file upload is 30 sec
clientConfiguration.connectionTimeout = 3 * 1000
clientConfiguration.socketTimeout = 30 * 1000
clientConfiguration.maxErrorRetry = 3
clientConfiguration.maxConnections = 8

val developerProvider = AwsPromotionAuthenticationProvider(
        openTokenResponse.accountId, identityPoolId,
        region, openTokenResponse)

/**
 * We do not want to use CognitoCacheCredentialsProvider here. As
 * it caches token in shared preferences for sub sequent requests
 */
val credentialsProvider = CognitoCredentialsProvider(
        developerProvider, region, clientConfiguration)

val s3Client = AmazonS3Client(credentialsProvider,
        clientConfiguration)
s3Client.setRegion(Region.getRegion(Regions.US_EAST_1))

s3Client.putObject(PutObjectRequest(bucket,
        openTokenResponse.identityId,
        File(createPromotionRequest.perk.photo)))

To help us solve your problem better, please answer the following list of questions.

  • What service are you using?
    S3
  • In what version of SDK are you facing the problem?
    2.2.13
  • Is the issue limited to Simulators / Actual Devices?
    Actual Device: Samsung Galaxy s7
  • Can your problem be resolved if you bump to a higher version of SDK?
    nope
  • Is this problem related to specific Android/OS version?
    not sure
  • Can you give us steps to reproduce with a minimal, complete, and verifiable example? Please include any specific network conditions that might be required to reproduce the problem.
    Please see top section
@karthiksaligrama
Copy link
Contributor

you are using sdk version 2.2.13 which is very old. I suggest you update your sdk to the latest version and give this a try.

@minbi
Copy link
Contributor

minbi commented May 4, 2017

Please re-open if there are further issues

@minbi minbi closed this as completed May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants