I keep getting random crashes of my app targeting ...
# kotlin-native
k
I keep getting random crashes of my app targeting linuxX64:
Copy code
/mnt/agent/work/f01984a9f5203417/runtime/src/main/cpp/Memory.cpp:1271: runtime assert: Must be positive
Any ideas how I can get some clue what am I doing wrong?
a
Hi, @Kuba Petržílka! This one seems like a bug. Please consider filing an issue on youtrack (kotl.in/issue). Also, please extend it with a project—it can be shared privately using visibility options.
k
Hi @Artyom Degtyarev [JB], Thanks for reply. Alright then I will try to isolate the problem and create some sample project that is reproducing it. But it is little bit hard since I don't how how I can debug easily. From first impression, it looks like it is related to use of Ktor client which creates a new worker/thread per each instance and doesn't join it even after calling close().
Copy code
fun main() = runBlocking {
    repeat(100) {
        val client = HttpClient(Curl)
        val data = client.get<String> {
            url("<http://google.com>")
        }
        println(data)
        client.close()
    }
}
prints:
Copy code
Unfinished workers detected, 100 workers leaked!
and I can see it in
htop
that there are just 100 of threads before the app is closed
a
This seems like a problem described here: https://youtrack.jetbrains.com/issue/KTOR-1220. However, I’m not sure if this problem is the same as the original
runtime assert
one.