Open 36yang opened 3 days ago
Hi!
If I understood correctly, all I need to do is set the number of threads to 4 and wait a few minutes for the PFX2 Sample to crash?
I'm going to need a way to repro otherwise (e.g. by modifying the Sample to trigger the crash).
Cheers
Yes, I can reproduce it 100% like this。
Thanks!
I was able to repro the problem.
Thread Sanitizer located the issue too.
ParticleSystemManager2::_updateParallel runs in two stages:
The problem is that the particles emitted in stage 1 by thread A may be in the middle of the range processed by stage 2 in thread B; thus the state of the particle becomes corrupt as A wants to reuse an inactive particle (to activate it) while B should be skipping that particle but seens it's suddenly active (because of A).
I'll need to think this through on how to fix it.
It's great to be able to find the problem. Multithreading is giving me a headache and I'm waiting for it to be fixed.
System Information
Detailled description
When I create a multi-threaded(4 thread) scene manager and use the particleSystem2 as Sample, waiting for 3-5 minutes will randomly encounter many problems, such as throwing multiple exceptions or encountering particles Only one particle can be emitted at a time when the upper limit is reached, and there are actually no live particles.
Ogre.log
Callstack
Here is my screenshot: