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

sendoav

04/07/2022, 8:52 PM
Hi all! I'm using Ktor in a KMM project. I have a singleton HttpClient and singleton HttpClientEngine for that client. Calls from Android side goes well but in the iOS side after making any request with that client the connection seems to be closed automatically, the server tells me that the client has sent a TCP FIN packet, but I'm not closing anything, at least not intentionally. The complete message from the server is "Connection id "0HMGOM971DIK1" sending FIN because: "The client closed the connection.". Do I need to configure anything in the iOS engine?
c

Casey Brooks

04/07/2022, 10:13 PM
What version of
kotlinx.coroutines
is in your iOS app? It might be crashing to due Native immutability issues with coroutines lib, but I believe Ktor works with either 1.6.0 and the new memory model enabled, or with older
-native-mt
versions
s

sendoav

04/08/2022, 6:36 AM
I have tested with Kotlin 1.6.20-M1 & coroutine 1.6.1 and also Kotlin 1.5.30 & coroutine 1.5.2-mt. The response seems to be received by the ktor client in iOS side as well, but after each request the connection is closed
a

Aleksei Tirman [JB]

04/08/2022, 8:59 AM
Could you please file an issue with a sample project attached to reproduce your problem?
s

sendoav

04/08/2022, 3:53 PM
Umm I cannot share the current project, but I think you can reproduce the bug with any example project using iOS. I noticed the issue when reviewing logs from a console of an API launched in Visual Studio
Finally I have created an issue with a little simple project, thanks guys
Hi Aleksei, do you have any estimation if when would you try to review the bug above? Performance is a key factor for us and we are thinking on using Alamofire for iOS calls in the meantime, but if you have any clue that bug should be fixed in the following weeks/months we will stay with Ktor
8 Views