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

Slackbot

09/15/2020, 12:22 PM
This message was deleted.
k

Kris Wong

09/15/2020, 12:59 PM
first thing i would suspect is the user agent
d

Daniele B

09/15/2020, 1:18 PM
it is very strange, because the server sees no request
k

Kris Wong

09/15/2020, 1:21 PM
is there some kind of firewall/gateway?
d

Daniele B

09/15/2020, 1:25 PM
I am testing on the iOS simulator, which seems correctly connected to the internet (safari works)
I also tested on a real iPhone device, and it gives the same problem
I wonder if there is anything that should be set in the iOS application to be able to connect to the internet, similar to the Android manifest permission
no, I just realized it’s nothing to do with internet permissions or connection. I am debugging now
CRAZY STUFF! I found out!!!
so the requested url was of the form: https://server.com/endpoint
but the server was redirecting it to: https://server.com/endpoint/
the console was only logging this 301 Moved Permanently
which actually was not the problem
if I specify the URL without the redirect: “https://server.com/endpoint/
the error manifests itself
but it’s very strange that if the specified URL was the previous one, the error would not appear
this is the error:
Copy code
Uncaught Kotlin exception: kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[MainDispatcher, Continuation @ $split$lambda-0$<anonymous>_3COROUTINE$2]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
    at 0   shared                              0x000000011008ce7c kfun:kotlin.Error#<init>(kotlin.String?;kotlin.Throwable?){} + 124 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:14:63)
    at 1   shared                              0x00000001102107ec kfun:kotlinx.coroutines.CoroutinesInternalError#<init>(kotlin.String;kotlin.Throwable){} + 124 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Exceptions.common.kt:28:77)
    at 2   shared                              0x0000000110279069 kfun:kotlinx.coroutines.DispatchedTask#handleFatalException(kotlin.Throwable?;kotlin.Throwable?){} + 953 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:93:22)
    at 3   shared                              0x0000000110278c47 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3543 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:64:13)
    at 4   shared                              0x00000001102ae5b8 kfun:kotlinx.coroutines.DarwinMainDispatcher.dispatch$lambda-0#internal + 88 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:35:19)
    at 5   shared                              0x00000001102ae98e kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$lambda-0$FUNCTION_REFERENCE$41.invoke#internal + 62 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:34:51)
    at 6   shared                              0x00000001102ae9ee kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$lambda-0$FUNCTION_REFERENCE$41.$<bridge-UNN>invoke(){}#internal + 62 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:34:51)
    at 7   shared                              0x00000001102afaa7 _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge8 + 183 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:34:51)
    at 8   libdispatch.dylib                   0x0000000114c5d951 _dispatch_call_block_and_release + 12
    at 9   libdispatch.dylib                   0x0000000114c5e8cb _dispatch_client_callout + 8
    at 10  libdispatch.dylib                   0x0000000114c6acdb _dispatch_main_queue_callback_4CF + 1042
    at 11  CoreFoundation                      0x00000001142c1869 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    at 12  CoreFoundation                      0x00000001142bc3b9 __CFRunLoopRun + 2041
    at 13  CoreFoundation                      0x00000001142bb8a4 CFRunLoopRunSpecific + 404
    at 14  GraphicsServices                    0x00000001168f7bbe GSEventRunModal + 139
    at 15  UIKitCore                           0x000000011ee46964 UIApplicationMain + 1605
    at 16  iosApp                              0x000000010fe7405b main + 75 (/Users/daniele/Dev/KMP/CovidApp/iosApp/iosApp/AppDelegate.swift:4:7)
    at 17  libdyld.dylib                       0x0000000114ce31fd start + 1
    at 18  ???                                 0x0000000000000001 0x0 + 1
Caused by: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler ChildCompletion[ChildHandle[DeferredCoroutine{Cancelled}@247fc38], kotlin.Unit] for DeferredCoroutine{Cancelled}@247fc38
    at 0   shared                              0x000000011008d03c kfun:kotlin.Exception#<init>(kotlin.String?;kotlin.Throwable?){} + 124 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:25:63)
    at 1   shared                              0x000000011008d28c kfun:kotlin.RuntimeException#<init>(kotlin.String?;kotlin.Throwable?){} + 124 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:36:63)
    at 2   shared                              0x000000011021074c kfun:kotlinx.coroutines.CompletionHandlerException#<init>(kotlin.String;kotlin.Throwable){} + 124 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Exceptions.common.kt:13:78)
    at 3   shared                              0x0000000110215f46 kfun:kotlinx.coroutines.JobSupport.notifyCompletion#internal + 1606 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:365:9)
    at 4   shared                              0x0000000110214b78 kfun:kotlinx.coroutines.JobSupport.completeStateFinalization#internal + 1464 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:326:25)
    at 5   shared                              0x0000000110212d09 kfun:kotlinx.coroutines.JobSupport.finalizeFinishingState#internal + 1705 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:241:9)
    at 6   shared                              0x000000011021fc14 kfun:kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath#internal + 2036 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:922:16)
    at 7   shared                              0x000000011021f2f0 kfun:kotlinx.coroutines.JobSupport.tryMakeCompleting#internal + 736 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:875:16)
    at 8   shared                              0x000000011021ed12 kfun:kotlinx.coroutines.JobSupport#makeCompletingOnce(kotlin.Any?){}kotlin.Any? + 642 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:840:30)
    at 9   shared                              0x00000001101f3576 kfun:kotlinx.coroutines.AbstractCoroutine#resumeWith(kotlin.Result<1:0>){} + 310 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/AbstractCoroutine.kt:111:21)
    at 10  shared                              0x00000001100b602a kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 1450 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:43:32)
    at 11  shared                              0x0000000110278728 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2232 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:53:21)
    at 12  shared                              0x00000001102ae5b8 kfun:kotlinx.coroutines.DarwinMainDispatcher.dispatch$lambda-0#internal + 88 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:35:19)
    ... and 14 more common stack frames skipped
Caused by: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.AwaitAll.AwaitAllNode@91ada8
    at 0   shared                              0x000000011009424d kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Throwable.kt:23:37)
    at 1   shared                              0x000000011008cf8b kfun:kotlin.Exception#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:23:44)
    at 2   shared                              0x000000011008d1db kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:34:44)
    at 3   shared                              0x00000001100c2f9b kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt:22:60)
    at 4   shared                              0x00000001100c4852 ThrowInvalidMutabilityException + 690 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:92:11)
    at 5   shared                              0x00000001101bef9c MutationCheck + 108
    at 6   shared                              0x00000001101f5bc6 kfun:kotlinx.coroutines.AwaitAll.AwaitAllNode.<set-handle>#internal + 102 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Await.kt:94:18)
    at 7   shared                              0x00000001101f4d98 kfun:kotlinx.coroutines.AwaitAll.await#internal + 1240 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Await.kt:68:17)
    at 8   shared                              0x00000001101f4301 kfun:kotlinx.coroutines.$awaitAllCOROUTINE$1#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 1425 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Await.kt:38:62)
    at 9   shared                              0x00000001101f45d4 kfun:kotlinx.coroutines#awaitAll@kotlin.collections.Collection<kotlinx.coroutines.Deferred<0:0>>(){0§<kotlin.Any?>}kotlin.collections.List<0:0> + 244 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Await.kt:37:16)
    at 10  shared                              0x0000000110391416 kfun:io.ktor.util.$split$lambda-0COROUTINE$3.invokeSuspend#internal + 2358 (/opt/buildAgent/work/a85294440dc5c6e/ktor-utils/common/src/io/ktor/util/ByteChannels.kt:29:23)
    at 11  shared                              0x00000001100b5d76 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 758 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:30:39)
    at 12  shared                              0x0000000110278962 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2802 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:39:50)
    at 13  shared                              0x00000001102ae5b8 kfun:kotlinx.coroutines.DarwinMainDispatcher.dispatch$lambda-0#internal + 88 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:35:19)
    ... and 14 more common stack frames skipped
So, it looks like the error is solved if the logging level is INFO, instead of ALL
Once that was problem was solved, I found another one, which was solved by adding the annotation @ThreadLocal
3 Views