Open waneck opened 5 years ago
Do you have this change? https://github.com/HaxeFoundation/hxcpp/commit/bfd7420cb2fd3f05750e0409f880ecf8e42ff299 (should be in 4.0.19)
This was made shortly before your report, but seems a possible cause/solution. If your problem persists after this, I can have a better look.
I've been seeing some occasional race conditions happening in Unreal.hx when running multiple external threads, which I believe are caused by the hxcpp GC. I was able to reduce the crash to this example. Tracing it further, I think I found the root cause of it. The GC is running the following stack trace:
while in another thread, it is running the following:
At this point, this thread that is marking has gone already through the point where
ClearRowMarks
is called - this means that the thread that is runningreclaim
thinks that all blocks are unmarked, so it starts reclaiming them. This causes all sorts of different crashes at runtime.At first I believed that this would be related to the way Unreal.hx registers an external thread stack (with
gc_set_top_of_stack(top_of_stack,false)
/gc_set_top_of_stack(0,false)
), but I couldn't figure out from the Immix code what would be the normal safeguards that don't allowReclaimAsync
to run concurrently with a mark phase, since there doesn't seem to be any locks preventing that from happening.Let me know if you'd like me to provide you with a build that shows this issue happening. I recorded a rr run of the failure, so I can replay this exact issue multiple times. Let me know if you need more information about it!