javax.net.ssl.SSLException во время многочастной загрузки Amazon S3
Я использую Simpl3r, простой API-интерфейс высокого уровня для надежной и возобновляемой многоэтапной загрузки файлов с помощью сервиса Amazon S3, чтобы загружать мультимедийные файлы в мое ведро.
При некоторых загрузках я получаю сообщение об ошибке SSLException. Вот код, где выдается исключение:
(Мой класс является подклассом IntentService, как в примере Simpl3r)
@Override
protected void onHandleIntent(Intent intent) {
String filePath = intent.getStringExtra(ARG_FILE_PATH);
final String s3ObjectKey = intent.getStringExtra(ARG_OBJECT_KEY);
File fileToUpload = new File(filePath);
String s3BucketName = getString(R.string.s3_bucket);
final String msg = "Uploading " + s3ObjectKey + "...";
// create a new uploader for this file
uploader = new Uploader(this, s3Client, s3BucketName, s3ObjectKey, fileToUpload);
// listen for progress updates and broadcast/notify them appropriately
uploader.setProgressListener(new UploadProgressListener() {
@Override
public void progressChanged(ProgressEvent progressEvent,
long bytesUploaded, int percentUploaded) {
Notification notification = buildNotification(msg, percentUploaded);
nm.notify(NOTIFY_ID_UPLOAD, notification);
broadcastState(s3ObjectKey, percentUploaded, msg);
}
});
// broadcast/notify that our upload is starting
Notification notification = buildNotification(msg, 0);
nm.notify(NOTIFY_ID_UPLOAD, notification);
broadcastState(s3ObjectKey, 0, msg);
try {
String s3Location = uploader.start(); // initiate the upload
broadcastStateDone(s3ObjectKey, s3Location, "File successfully uploaded to " + s3Location);
} catch (UploadIterruptedException uie) {
broadcastStateError(s3ObjectKey, "User interrupted");
} catch (Exception e) {
e.printStackTrace();
broadcastStateError(s3ObjectKey, "Error: " + e.getMessage());
}
}
Вот трассировка стека:
04-28 10:18:35.482 28236-28304/org.dornad.s3test I/AmazonHttpClient﹕ Unable to execute HTTP request: Write error: ssl=0x5c7c7760: I/O error during system call, Connection reset by peer
javax.net.ssl.SSLException: Write error: ssl=0x5c7c7760: I/O error during system call, Connection reset by peer
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_write(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:706)
at com.amazonaws.org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:169)
at com.amazonaws.org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:119)
at com.amazonaws.org.apache.http.entity.InputStreamEntity.writeTo(InputStreamEntity.java:102)
at com.amazonaws.http.RepeatableInputStreamRequestEntity.writeTo(Unknown Source)
at com.amazonaws.org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:98)
at com.amazonaws.org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)
at com.amazonaws.org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:122)
at com.amazonaws.org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:271)
at com.amazonaws.org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:197)
at com.amazonaws.org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:257)
at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doSendRequest(Unknown Source)
at com.amazonaws.org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:717)
at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:522)
at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
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.uploadPart(Unknown Source)
at com.readystatesoftware.simpl3r.Uploader.start(Uploader.java:162)
at org.dornad.s3test.service.UploadService.onHandleIntent(UploadService.java:96)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
Исключение не охватывается моим предложением об исключении. Это означает, что приложение застряло в состоянии "загрузки", которое никогда не заканчивается.
Есть идеи?
1 ответ
Сколько времени занимает загрузка? Не могли бы вы получить сброс?