Jérôme Gully
01/13/2021, 2:24 PMfun main() {
println("----------- Hello, Kotlin/Native! -----------")
Platform.isMemoryLeakCheckerActive = false // mandatory but fixed in 1.5.1
val api = Api()
}
class Api {
init {
ensureNeverFrozen()
}
val email = "<mailto:email@email.com|email@email.com>"
val password = "Password123"
private val httpClient = HttpClient {
defaultRequest {
// this is working
header("Authorization", "Basic <mailto:email@email.com|email@email.com>:Password123")
// this is not working
header("Authorization", "Basic $email:$password")
}
}
}
output with ensureNeverFrozen:
----------- Hello, Kotlin/Native! -----------
Uncaught Kotlin exception: kotlin.native.concurrent.FreezingException: freezing of <object>@24bfb48 has failed, first blocker is Api@24afdb8
at kfun:kotlin.Throwable#<init>(kotlin.String?){} (0x309cb9)
at kfun:kotlin.Exception#<init>(kotlin.String?){} (0x302ee7)
at kfun:kotlin.RuntimeException#<init>(kotlin.String?){} (0x303097)
at kfun:kotlin.native.concurrent.FreezingException#<init>(kotlin.Any;kotlin.Any){} (0x33518e)
at ThrowFreezingException (0x33669f)
at _ZN12_GLOBAL__N_114freezeSubgraphEP9ObjHeader (0x699b0a)
at Kotlin_Worker_freezeInternal (0x6b7a14)
at kfun:kotlin.native.concurrent#freeze@0:0(){0§<kotlin.Any?>}0:0 (0x334ebd)
at kfun:io.ktor.utils.io.concurrent.object-1.<init>#internal (0x4f049e)
at kfun:io.ktor.util.collections.internal.MapNode#<init>(1:0;1:1){} (0x526d98)
at kfun:io.ktor.util.collections.ConcurrentMap.put$lambda-3#internal (0x51a850)
at kfun:io.ktor.util.collections.ConcurrentMap.$put$lambda-3$FUNCTION_REFERENCE$147.invoke#internal (0x51d6bc)
at kfun:io.ktor.util.collections.ConcurrentMap.locked#internal (0x5198d8)
at kfun:io.ktor.util.collections.ConcurrentMap#put(1:0;1:1){}1:1? (0x5182a5)
at kfun:io.ktor.client.HttpClientConfig#install(io.ktor.client.features.HttpClientFeature<0:0,0:1>;kotlin.Function1<0:0,kotlin.Unit>){0§<kotlin.Any>;1§<kotlin.Any>} (0x58bed9)
at kfun:io.ktor.client.features#defaultRequest@io.ktor.client.HttpClientConfig<*>(kotlin.Function1<io.ktor.client.request.HttpRequestBuilder,kotlin.Unit>){} (0x59daa2)
at kfun:Api.<init>$lambda-1#internal (0x6551dd)
at kfun:Api.$<init>$lambda-1$FUNCTION_REFERENCE$0.invoke#internal (0x65532b)
at kfun:Api.$<init>$lambda-1$FUNCTION_REFERENCE$0.$<bridge-UNNN>invoke(-1:0){}#internal (0x6553ab)
at kfun:io.ktor.client#HttpClient(io.ktor.client.engine.HttpClientEngineFactory<0:0>;kotlin.Function1<io.ktor.client.HttpClientConfig<0:0>,kotlin.Unit>){0§<io.ktor.client.engine.HttpClientEngineConfig>}io.ktor.client.HttpClient (0x589a4d)
at kfun:io.ktor.client#HttpClient(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>){}io.ktor.client.HttpClient (0x5cdf43)
at kfun:Api#<init>(){} (0x654aeb)
at kfun:#main(){} (0x655640)
at Konan_start (0x65572b)
at Init_and_run_start (0x68529b)
at __libc_start_main (0x7ff2e0e780b3)
at (0x2bb029)
at ((nil))
There is some bug with io.ktor.util.collections.internal.MapNode ?