Closed
Description
Newest version (0.14.3) does not reconnect if network is down.
Expected Behavior
When network is lost reconnectable should trigger reconnect attempts and recover if network is available again.
Actual Behavior
App crashes with the following log if wifi is turned off:
2021-12-21 12:41:46.525 22099-22156/? W/SDK: ⚠️ Unable to connect to WS. Retrying...
2021-12-21 12:41:46.525 22099-22156/? W/SDK: ⚠️ Network is unreachable
2021-12-21 12:41:46.530 22099-22158/? E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-14
Process: my.namespace.demoapp, PID: 22099
java.io.IOException: Software caused connection abort
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:421)
at io.ktor.network.sockets.CIOReaderKt$readFrom$2.invoke(CIOReader.kt:129)
at io.ktor.network.sockets.CIOReaderKt$readFrom$2.invoke(CIOReader.kt:128)
at io.ktor.utils.io.ByteBufferChannel.writeAvailable(ByteBufferChannel.kt:1492)
at io.ktor.utils.io.ByteBufferChannel.write$suspendImpl(ByteBufferChannel.kt:1522)
at io.ktor.utils.io.ByteBufferChannel.write(Unknown Source:0)
at io.ktor.utils.io.ByteWriteChannel$DefaultImpls.write$default(ByteWriteChannel.kt:99)
at io.ktor.network.sockets.CIOReaderKt.readFrom(CIOReader.kt:128)
at io.ktor.network.sockets.CIOReaderKt.access$readFrom(CIOReader.kt:1)
at io.ktor.network.sockets.CIOReaderKt$attachForReadingDirectImpl$1.invokeSuspend(CIOReader.kt:108)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:234)
at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:190)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
at io.ktor.network.selector.SelectorManagerSupport.handleSelectedKey(SelectorManagerSupport.kt:80)
at io.ktor.network.selector.SelectorManagerSupport.handleSelectedKeys(SelectorManagerSupport.kt:60)
at io.ktor.network.selector.ActorSelectorManager.process(ActorSelectorManager.kt:71)
at io.ktor.network.selector.ActorSelectorManager.access$process(ActorSelectorManager.kt:18)
at io.ktor.network.selector.ActorSelectorManager$process$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Steps to Reproduce
Reconnectable configuration (was not changed from previous versions) in commonMain:
reconnectable(10, predicate = {
warningLog("Unable to connect to WS. Retrying...")
warningLog("${it.message}")
delay(1000)
true
})
Initial connection configuration:
val transport = TcpClientTransport(host, 8000)
val rsocker = connector(uniqueDeviceId, authToken.access_token).connect(transport)
Your Environment
kotlinVersion=1.6.10
coroutinesBaseVersion=1.5.1-new-mm-dev2
ktorVersion=1.6.2-native-mm-eap-196
rsocketVersion=0.14.3
serializationVersion=1.3.0
klockVersion=2.4.8
Maybe it has something to do with: #150
Metadata
Metadata
Assignees
Labels
No labels