Hi guys, I'm fighting with a KN runtime abort issu...
# kotlin-native
p
Hi guys, I'm fighting with a KN runtime abort issue, the abort code is in
freezeSubgraph
function of
Memory.cpp
:
Copy code
#if USE_GC
  // Now remove frozen objects from the toFree list.
  // TODO: optimize it by keeping ignored (i.e. freshly frozen) objects in the set,
  // and use it when analyzing toFree during collection.
  auto state = memoryState;
  for (auto& container : *(state->toFree)) {
    if (!isMarkedAsRemoved(container) && container->frozen()) {
      RuntimeAssert(newlyFrozen.count(container) != 0, "Must be newly frozen");  // <=== here
      container = markAsRemoved(container);
    }
  }
#endif
The abort seems happen randomly, I really don't know what's wrong with my code. I tried to comment this line, it seems work fine, I'd like to know what's the possible problem if this condition is false? Would there be other problem if I comment this code? Thank you! I really need your help, genius at JB!
a
Hello, can you please share a reproducer here? It’s hard to tell anything specific without any example to play with.
p
Hi @Artyom Degtyarev [JB], thank you for the reply, this problem couldn't be reproduced with a simple project, I can only reproduce it in my complex project. I can provide it. Please check 
docs/kn_freeze_abort_debug.md
 for setup guide. Thank you so much! BTW, actually I provided this project to @kpgalligan months ago, he could reproduce it in this project at his side too.
Hi @Artyom Degtyarev [JB], good morning! is there any update about this problem? thank you!
s
Hello. Thanks for providing the project! Artyom is on vacation at the moment. We will check the project later.
Meanwhile, could you please test your project on 1.4-RC? We’ve added some runtime checks that could help you to find a relevant problem in your code.
p
Thank you for the update! I tried 1.4-RC earlier, the issue still exists.
s
I have checked your application with 1.4-RC. It doesn’t fail with the same assertion on my side. Instead, as I suspected, it reports illegal object sharing. This can be a reason for the original assertion crash in 1.3.70. Please try 1.4-RC, fix illegal object sharing and recheck if the the issue still exists.
p
Okay, thank you for your time! I'll try 1.4-RC again.
👍 1