element-hq / element-hq/element-android
Fatal Exception: javax.net.ssl.SSLException
- Dominant language
- Kotlin
- Stars
- 3.7k
- Forks
- 917
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The bug happens when I turn off the internet connection when the image files are being downloaded.
**To Reproduce**
I download the image files in the list when the user scrolls it up and I turn off the internet connection during file uploading.
The code I use to download the files is inside the viewmodel and looks like this
```
viewModelScope.launch(downloaderJob + Dispatchers.Main) {
try {
val fileDownloadingResponse = awaitCallback {
sessionHolder.currentSession?.fileService()?.downloadFile(messageContent, it)
}
_successResult.value = Pair(itemId, fileDownloadingResponse.path)
} catch (e: Exception) {
e.printStackTrace()
_errorResult.value = Pair(itemId, e.message)
}
}
```
The bug happens:
Android version 9
Galaxy S8+
Matrix Version: 1.1.1,
Android version 10
Galaxy S9+
Matrix Version: 1.1.1.
** Screenshots**

**Logs**
Fatal Exception: javax.net.ssl.SSLException: Read error: ssl=0x6f579e4b88: I/O error during system call, Software caused connection abort
at com.android.org.conscrypt.NativeCrypto.SSL_read(NativeCrypto.java)
at com.android.org.conscrypt.NativeSsl.read(NativeSsl.java:407)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(ConscryptFileDescriptorSocket.java:579)
at okio.InputStreamSource.read(InputStreamSource.java:45)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.java:12)
at okio.RealBufferedSource.read(RealBufferedSource.java:4)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.java:11)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.java:37)
at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.java:15)
at okio.RealBufferedSource.read(RealBufferedSource.java:4)
at okio.ForwardingSource.read(ForwardingSource.java:7)
at org.matrix.android.sdk.internal.session.download.ProgressResponseBody$source$1.read(ProgressResponseBody.java:5)
at okio.RealBufferedSource$inputStream$1.read(RealBufferedSource.java:4)
at java.io.InputStream.read(InputStream.java:101)
at kotlin.io.ByteStreamsKt.copyTo(ByteStreamsKt.java:26)
at kotlin.io.ByteStreamsKt.copyTo$default(ByteStreamsKt.java:6)
at org.matrix.android.sdk.internal.util.FileSaverKt.writeToFile(FileSaverKt.java:20)
at org.matrix.android.sdk.internal.session.DefaultFileService$downloadFile$3$1.invokeSuspend(DefaultFileService.java:20)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:2)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:74)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:5)
Contributor guide
Assessment
This issue has not been assessed yet.