Mina Eweida

    Mina Eweida

    2 years ago
    Hi, I was reading about not using Ktor coroutines-interop
    Ktor does not work well in multithreaded environment in Kotlin/Native (it may crash), so please don’t mix Ktor and 
    coroutines-interop
    My question is, does it crash with a specific type of request i.e. get, post? Because my use case is simply fire and forget a post request, I am not expecting any response. So does it crash because of multithreading and sharing results or crashes were reported on firing requests in general?
    Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    Hi. Ktor is very likely to crash when used from a background thread. Does not matter if you are waiting for a result or not. You can read more in this issue. If you really need to use the Ktor then you can try
    singleFromCoroutineUnsafe
    sample from README. But make sure everything is on main thread.