https://kotlinlang.org logo
Title
k

Kris Wong

10/19/2020, 5:37 PM
I am still getting crashes from Ktor on iOS...
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared <object>@508748 from other thread
    at 0   VMwareBoxer                         0x000000010dee60bd kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93
    at 1   VMwareBoxer                         0x000000010dedef7b kfun:kotlin.Exception#<init>(kotlin.String?){} + 91
    at 2   VMwareBoxer                         0x000000010dedf1cb kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 91
    at 3   VMwareBoxer                         0x000000010df1348b kfun:kotlin.native.IncorrectDereferenceException#<init>(kotlin.String){} + 91
    at 4   VMwareBoxer                         0x000000010df177ad ThrowIllegalObjectSharingException + 621
    at 5   VMwareBoxer                         0x000000010dffdcf2 _ZN12_GLOBAL__N_128throwIllegalSharingExceptionEP9ObjHeader + 34
    at 6   VMwareBoxer                         0x000000010e00221e _ZNK27BackRefFromAssociatedObject3refEv + 78
    at 7   VMwareBoxer                         0x000000010dfe88c4 _ZN12_GLOBAL__N_111toKotlinImpEP11objc_objectP13objc_selectorPP9ObjHeader + 52
    at 8   VMwareBoxer                         0x000000010e0296f1 Kotlin_Interop_refFromObjC + 65
    at 9   VMwareBoxer                         0x000000010e2f8499 _696f2e6b746f723a6b746f722d636c69656e742d696f73_knbridge28 + 345
    at 10  VMwareBoxer                         0x000000010e3012ca _696f2e6b746f723a6b746f722d636c69656e742d696f73_kncfun30 + 74
    at 11  TrustKit                            0x00000001153174a9 -[TSKNSURLSessionDelegateProxy URLSession:task:didReceiveChallenge:completionHandler:] + 281 (/Users/krisw/Dev/boxer/boxer-iphone/Pods/TrustKit/TrustKit/Swizzling/TSKNSURLSessionDelegateProxy.m:186:5)
    at 12  CFNetwork                           0x00007fff236ab2d2 _CFNetworkHTTPConnectionCacheSetLimit + 155178
    at 13  libdispatch.dylib                   0x000000011a7128ac _dispatch_call_block_and_release + 12
    at 14  libdispatch.dylib                   0x000000011a713a88 _dispatch_client_callout + 8
    at 15  libdispatch.dylib                   0x000000011a721f23 _dispatch_main_queue_callback_4CF + 1152
    at 16  CoreFoundation                      0x00007fff203a8276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    at 17  CoreFoundation                      0x00007fff203a2b06 __CFRunLoopRun + 2685
    at 18  CoreFoundation                      0x00007fff203a1b9e CFRunLoopRunSpecific + 567
    at 19  GraphicsServices                    0x00007fff2b773db3 GSEventRunModal + 139
    at 20  UIKitCore                           0x00007fff24660af3 -[UIApplication _run] + 912
    at 21  UIKitCore                           0x00007fff24665a04 UIApplicationMain + 101
    at 22  VMwareBoxer                         0x000000010c6849a5 main + 437 (/Users/krisw/Dev/boxer/boxer-iphone/Boxer/Boxer/main.m:43:13)
    at 23  libdyld.dylib                       0x00007fff20257415 start + 1
t

Thomas

10/19/2020, 5:59 PM
I ran into IncorrectDereferenceException as well with the iOS engine. Here is a fix: https://github.com/ktorio/ktor/pull/2092
k

Kris Wong

10/19/2020, 6:12 PM
thanks, subscribed. let's hope it gets into a release soon. though honestly at this point I don't trust that these types of crashers won't keep being introdced
it's too brittle
2
t

Thomas

11/11/2020, 6:30 PM
Yes you are right @Kris Wong. You don’t have to try Ktor 1.4.2 because it still crashes due to another recent commit that broke it again. I made a new PR https://github.com/ktorio/ktor/pull/2193 to fix the new issue. It looks like you need to wait for Ktor 1.4.3 unfortunately.
I did add a test this time for Ktor on Dispatchers.Default so hopefully it doesn’t happen again.
k

Kris Wong

11/12/2020, 1:55 PM
i've removed Ktor from our projects