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

Raymond Chan

07/15/2022, 3:03 AM
As per: https://kotlinlang.slack.com/archives/C0A974TJ9/p1654555064089159 We encountered similar problems too. We have included Ktor lib in our KMM project, however, we don’t invoke any Ktor related call in our iOS project. App crashed due to
Strings.kt line 296
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
We drilled down the logs on crashlytics a bit, and found that the app crashed during when our class
AnalyticsTracker
was initializing. However,
AnalyticsTracker
didn’t contain any Ktor related code, we are only accessing some constants defined in KMM. And what we found interesting is that we found stacktrace for
com.apple.main-thread
comes in with a little bit variation. You may check the attached stacktrace. Kotlin version: 1.5.31, Ktor version: 1.6.0
Stacktrace for Thread #1
Copy code
Crashed: Thread
0  9Gag                           0x55f634 kfun:kotlinx.cinterop#<get-cstr>__at__kotlin.String(){}kotlinx.cinterop.CValues<kotlinx.cinterop.ByteVarOf<kotlin.Byte>> + 296 (Strings.kt:296)
1  9Gag                           0x6e595c kfun:io.ktor.utils.io.charsets.CharsetImpl.<init>#internal + 26 (CharsetNative.kt:26)
2  9Gag                           0x6e5788 kfun:io.ktor.utils.io.charsets.Charsets#<init>(){} + 383 (CharsetNative.kt:383)
3  9Gag                           0xa698ec InitSingletonStrict + 4325644524
4  9Gag                           0x947104 __unnamed_2910 + 4324454660
5  9Gag                           0xa74630 Kotlin_initRuntimeIfNeeded + 4325688880
6  9Gag                           0xa7698c (anonymous namespace)::workerRoutine(void*) + 4325697932
7  ???                            0x18251c2c0 (Missing)
8  ???                            0x18251c220 (Missing)
9  ???                            0x18251fcdc (Missing)
We also see another crash related to
DefaultPool.kt
Stacktrace for Thread #1
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000008
Copy code
Crashed: Thread
0  9Gag                           0x6ef6b0 kfun:io.ktor.utils.io.pool.DefaultPool.<get-size>#internal + 13 (DefaultPool.kt:13)
1  9Gag                           0x6efa80 kfun:io.ktor.utils.io.pool.DefaultPool#borrow(){}1:0 + 22 (DefaultPool.kt:22)
2  9Gag                           0x6d7578 kfun:io.ktor.utils.io.core.internal.ChunkBuffer.Companion.object-1.borrow#internal + 136 (ChunkBuffer.kt:136)
3  9Gag                           0x6e6dc8 kfun:io.ktor.utils.io.charsets#encodeToByteArray__at__io.ktor.utils.io.charsets.CharsetEncoder(kotlin.CharSequence;kotlin.Int;kotlin.Int){}kotlin.ByteArray + 147 (Encoding.kt:147)
4  9Gag                           0x947134 __unnamed_2910 + 4310872372
5  9Gag                           0xa74630 Kotlin_initRuntimeIfNeeded + 4312106544
6  9Gag                           0xa7698c (anonymous namespace)::workerRoutine(void*) + 4312115596
7  ???                            0x18649d2c0 (Missing)
8  ???                            0x18649d220 (Missing)
9  ???                            0x1864a0cdc (Missing)
com.apple.main-thread
Copy code
com.apple.main-thread
0  9Gag                           0x5f0344 kfun:kotlin.collections#putAll__at__kotlin.collections.MutableMap<in|0:0,in|0:1>(kotlin.Array<out|kotlin.Pair<0:0,0:1>>){0§<kotlin.Any?>;1§<kotlin.Any?>} + 4320953156 (Maps.kt:4320953156)
1  9Gag                           0x9399ac __unnamed_2910 + 4324399532
2  9Gag                           0xa7460c Kotlin_initRuntimeIfNeeded + 4325688844
3  9Gag                           0xa649a4 +[KotlinBase allocWithZone:] + 4325624228
4  9Gag                           0x1ae838 AnalyticsTracker.init() + 4316489784 (<compiler-generated>:4316489784)
5  9Gag                           0x1ae63c one-time initialization function for shared + 28 (AnalyticsTracker.swift:28)
6  ???                            0x18233c7d4 (Missing)
7  ???                            0x1822dfeb8 (Missing)
8  ???                            0x1b0139e40 (Missing)
9  9Gag                           0xbaa0c specialized MixpanelApplictionService.application(_:didFinishLaunchingWithOptions:) + 28 (AnalyticsTracker.swift:28)
10 9Gag                           0xba7e4 @objc MixpanelApplictionService.application(_:didFinishLaunchingWithOptions:) + 4315490276 (<compiler-generated>:4315490276)
11 ???                            0x10459a51c (Missing)
12 9Gag                           0x88d4c AppDelegate.application(_:didFinishLaunchingWithOptions:) + 51 (AppDelegate.swift:51)
13 9Gag                           0x890d0 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 4315287760 (<compiler-generated>:4315287760)
14 ???                            0x1aed4a0f0 (Missing)
15 ???                            0x1aed4b854 (Missing)
16 ???                            0x1aed50fe0 (Missing)
17 ???                            0x1ae6142a4 (Missing)
18 ???                            0x1ae61c83c (Missing)
19 ???                            0x1ae613f28 (Missing)
20 ???                            0x1ae614818 (Missing)
21 ???                            0x1ae612b64 (Missing)
22 ???                            0x1ae61282c (Missing)
23 ???                            0x1ae61736c (Missing)
24 ???                            0x1ae618150 (Missing)
25 ???                            0x1ae617224 (Missing)
26 ???                            0x1ae61bf24 (Missing)
27 ???                            0x1aed4f5e8 (Missing)
28 ???                            0x1ae94be04 (Missing)
29 ???                            0x18527b9fc (Missing)
30 ???                            0x18528540c (Missing)
31 ???                            0x185284c14 (Missing)
32 ???                            0x18233c7d4 (Missing)
33 ???                            0x1822e15dc (Missing)
34 ???                            0x1852b6040 (Missing)
35 ???                            0x1852b5cdc (Missing)
36 ???                            0x1852b6294 (Missing)
37 ???                            0x18288ff1c (Missing)
38 ???                            0x18288fe9c (Missing)
39 ???                            0x18288f784 (Missing)
40 ???                            0x18288a6c0 (Missing)
41 ???                            0x182889fb4 (Missing)
42 ???                            0x184a8c79c (Missing)
43 ???                            0x1aed52c38 (Missing)
44 9Gag                           0x12e50 main + 13 (main.swift:13)
Strings.kt
crash mostly related to iOS 12, while
DefaultPool.kt
crash mostly related to iOS 15
a

Aleksei Tirman [JB]

07/15/2022, 9:16 AM
Could you please file an issue with a sample project for reproduction attached?
6 Views