https://kotlinlang.org logo
#ktor
Title
# ktor
g

Gus

01/27/2021, 5:48 PM
Hey folks. I'm getting a rather unhelpful exception from ktor (with okhttp) on Android:
Copy code
java.io.IOException: 
  at sun.nio.ch.IOUtil.makePipe (Native Method)
  at sun.nio.ch.PollSelectorImpl.<init> (PollSelectorImpl.java:57)
  at sun.nio.ch.PollSelectorProvider.openSelector (PollSelectorProvider.java:36)
  at io.ktor.network.selector.ActorSelectorManager$1.invokeSuspend (ActorSelectorManager.kt:41)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  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)
And to make matters worse, the user who experienced it sent the crash report to Google Play Store anonymously, so I can't contact them to ask for more info. I can't reproduce it either (even though I coincidentally have the same phone). Any thoughts on how to get to the bottom of this? It seems like it's happened 5 times to the same user (we're running a beta right now, so it may be a big issue when we eventually launch). I'm using Ktor via a library. Behind the scenes, that library keeps a WebSocket open and makes some
POST
requests when certain events happen. I can see that the library is properly handling `IOException`s in WebSocket and HTTP connections.
In case it's relevant, this app is meant to work when the Internet is unavailable, and it's quite likely that the user turned on airplane mode to see what would happen in that scenario. However, we're always testing the app by disconnecting and connecting the device to the Internet (using airplane mode, turning WIFi off, etc), and we've never experienced this issue.
That was with Ktor 1.4.1, in case it's relevant