We’re running into a strange issue in release iOS builds with the new memory model. Doesn’t happen in debug builds.
When a user opens/closes a particular screen multiple times, on the ~12th try, we trigger the GC, and it crashes the app.
The stracktrace looks something like:
Crashed: GC thread
0 QuizletSharedKotlin 0x919294 std::__1::invoke_result<kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2>::type kotlin::ScopedThread::Run<kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2>(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2&&) + 1292
1 QuizletSharedKotlin 0x91a214 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2&&), kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2> >(void*) + 112
2 libsystem_pthread.dylib 0x19ac _pthread_start + 148
3 libsystem_pthread.dylib 0xe68 thread_start + 8
It’s super hard for us to create a minimal reproduction of this, but in case it’s relevant, we’ve been able to repro this with:
• Kotlin 1.7.10 and 1.7.20-Beta
• SqlDelight 1.5.3 and 2.0.0-alpha03
• kotlinx.coroutines 1.6.4 (without the
-native-mt
suffix)
• KMP-NativeCoroutines 0.12.6-new-mm
Any tips on how to narrow this down?