Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Plugin extrimely unstable with Cloth Simulation. Unity crashes all time
#1
Exclamación 
I've got multiple crashes during simulation of hight poly cloth or after level unloading with ObiCloth after simulation. 
This looks like an internal crash produced by corrupted memory.
Unity also may throw a C# exception regarding some parts in code that never crash before (like a crash in transforms deep inside Unity) or crash with "pure virtual function call"  exception or just crash with a different stack trace (way more often).

Example of most common crash stack trace:
Code:
========== OUTPUTING STACK TRACE ==================

0x00007FFBE9C39BC4 (libOni) SetDiffuseParticleNeighbourCounts
0x00007FFBE9C3A5C8 (libOni) SetDiffuseParticleNeighbourCounts
0x00007FFBE9C6183D (libOni) GetPointCloudAnisotropy
0x00007FFBE9C64FE1 (libOni) GetPointCloudAnisotropy
0x00007FFBE9C669D1 (libOni) GetPointCloudAnisotropy
0x00007FFBE9C64AE9 (libOni) GetPointCloudAnisotropy
0x00007FFBE9C8C389 (libOni) GetPointCloudAnisotropy
0x00007FFC04EF3034 (KERNEL32) BaseThreadInitThunk
0x00007FFC052B1431 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

I use the high poly cloth plane (~ 3500 polygons) with Max Particles 10000 set up in solver. Settings for Cloth was taken from examples from Obi plugin. This cloth is colliding with hight poly surfaces up to ~12000 polygons with Obi Colliders on it and Mesh Collider.

I was spawning Solver and connect them to a simulated object in real-time. I also reuse solver for each simulated objects. It works ok in most cases but when I unload the scene after simulation it crashes with 90% crash rate. But only if simulation was performed.
When I do a simulation with Hight Poly Mesh Collider in 10-20% probability I got a crash. In most cases cloth just droping from top to the collider with gravity. So this happens during an actual collision. Not immediate but after 100-200 milliseconds.

This is impossible to use this plugin with such instability. I need to have lots of cloth in the scene and do lots of simulations. 
Could you fix this crashes or recommend a workaround on how to solve this problem?
This is a show stopper for me. 
My system is Windows 10 64bit. Unity 2017.4.5f1 LTS. Plugin version 3.5.


Update:
I am going to make a test project and deliver it to you. In this case roughly how long will it take to fix this bug?
Reply
#2
Update:

Wasn't able to reproduce this on the clear project. All looks stable both simulation and scene unloading after. Probably I've found some edge case. I will continue an investigation.
Reply
#3
Update 

According to my investigation crashes occurred when the active scene with simulated cloth and solver unloaded by SceneManager.UnloadSceneAsync in the Coroutine. I also have 3 scene loaded all time with UI and some singletons. But all Cloth related stuff spawned all-time in the active scene, the scene I unloaded later.  

In case if SceneManager.LoadLevel(0) function call (unloads all loaded scenes) all works fine and no Unity crash occurred during a long run. But this is not acceptable for me.

Obi developers, could you clarify are you using some code related to the way how scene loaded/unloaded in Unity? 
Because this issue probably related to this.
Reply
#4
(20-08-2018, 03:54 PM)mmortall Wrote: Update 

According to my investigation crashes occurred when the active scene with simulated cloth and solver unloaded by SceneManager.UnloadSceneAsync in the Coroutine. I also have 3 scene loaded all time with UI and some singletons. But all Cloth related stuff spawned all-time in the active scene, the scene I unloaded later.  

In case if SceneManager.LoadLevel(0) function call (unloads all loaded scenes) all works fine and no Unity crash occurred during a long run. But this is not acceptable for me.

Obi developers, could you clarify are you using some code related to the way how scene loaded/unloaded in Unity? 
Because this issue probably related to this.

Hi,

I was closely watching this thread in case you came back with any more info. However Obi does not do anything at all during scene loading/unloading, most code is called during FixedUpdate(), Update(), or LateUpdate(). We will try to reproduce the issue and investigate further.
Reply
#5
(20-08-2018, 04:29 PM)josemendez Wrote: Hi,

I was closely watching this thread in case you came back with any more info. However Obi does not do anything at all during scene loading/unloading, most code is called during FixedUpdate(), Update(), or LateUpdate(). We will try to reproduce the issue and investigate further.

Thanks a lot. I am really puzzled by this issue because I cannot debug it. Just tried lots fo tests and workarounds to localize the problem. This is indeed a memory corruption and I got so strange unity bugs when it happens. Even rendering bugs sometimes) Also it is a strong correlation on the number of simulated objects and crash rate.
I also tried to destroy solver and all Cloth components just a frame before I unload active level but this not help. I also use UniRx plugin as coroutine holder, but I never had problems with it.
I will try other things but later because I have other urgent tasks to do. For now, this quick workaround with LoadLevel(0) works for me. I will try to simulate this crashes in my test project and if I succeed I will share it with you asap. 
I also want to try latest LTS Unity release
Reply
#6
(20-08-2018, 04:29 PM)josemendez Wrote: Hi,

I was closely watching this thread in case you came back with any more info. However Obi does not do anything at all during scene loading/unloading, most code is called during FixedUpdate(), Update(), or LateUpdate(). We will try to reproduce the issue and investigate further.

josemendez, I was able to create a test project to reproduce this crash. I am preparing files for submission to some file hosting and provide you the link when it will be ready.
This crash related to the case when several solvers are created and used in runtime
Reply
#7
Project zip located here:
https://www75.zippyshare.com/v/sWFipAtQ/file.html

Unity can crash after 4-5 tries. But standalone build crash immediate.
Open main scene and press Play
Got good crash logs on mac os:
Code:
Thread 50 Crashed:
0   libsystem_kernel.dylib         0x00007fff57ad4e3e __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fff57c13150 pthread_kill + 333
2   libsystem_c.dylib             0x00007fff57a31312 abort + 127
3   libc++abi.dylib               0x00007fff55a0cf8f abort_message + 245
4   libc++abi.dylib               0x00007fff55a29952 __cxa_pure_virtual + 18
5   com.Ark.Oni                   0x00000001207e0d13 Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float)::'lambda'(std::__1::pair<int, int>)::operator()(std::__1::pair<int, int>) const + 275
6   com.Ark.Oni                   0x00000001207e09c4 std::__1::shared_ptr<Oni::Task> Oni::Parallel<Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float)::'lambda'(std::__1::pair<int, int>)>(Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float)::'lambda'(std::__1::pair<int, int>)&&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<Oni::Task> const&, int) + 84
7   com.Ark.Oni                   0x00000001207df140 Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float) + 736
8   com.Ark.Oni                   0x000000012080bd37 std::__1::shared_ptr<Oni::Task> Oni::Parallel<Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>::EvaluateGaussSeidel(float)::'lambda'(std::__1::pair<int, int>)>(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>::EvaluateGaussSeidel(float)::'lambda'(std::__1::pair<int, int>)&&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<Oni::Task> const&, int) + 119
9   com.Ark.Oni                   0x000000012080b555 Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>::EvaluateGaussSeidel(float) + 149
10  com.Ark.Oni                   0x000000012082c7b9 Oni::ConstraintGroupBase::Apply(float) + 425
11  com.Ark.Oni                   0x0000000120815ccc Oni::Solver::ProjectConstraints(float) + 508
12  com.Ark.Oni                   0x00000001207d13c1 Oni::Task::Perform() + 305
13  com.Ark.Oni                   0x00000001207e2227 std::__1::__thread_proxy<std::__1::tuple<Oni::TaskManager::TaskManager(unsigned int)::$_0> >(void*, void*) + 1047
14  libsystem_pthread.dylib       0x00007fff57c106c1 _pthread_body + 340
15  libsystem_pthread.dylib       0x00007fff57c1056d _pthread_start + 377
16  libsystem_pthread.dylib       0x00007fff57c0fc5d thread_start + 13
Reply
#8
(19-09-2018, 08:09 PM)mmortall Wrote: Project zip located here:
https://www75.zippyshare.com/v/sWFipAtQ/file.html

Unity can crash after 4-5 tries. But standalone build crash immediate.
Open main scene and press Play
Got good crash logs on mac os:
Code:
Thread 50 Crashed:
0   libsystem_kernel.dylib         0x00007fff57ad4e3e __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fff57c13150 pthread_kill + 333
2   libsystem_c.dylib             0x00007fff57a31312 abort + 127
3   libc++abi.dylib               0x00007fff55a0cf8f abort_message + 245
4   libc++abi.dylib               0x00007fff55a29952 __cxa_pure_virtual + 18
5   com.Ark.Oni                   0x00000001207e0d13 Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float)::'lambda'(std::__1::pair<int, int>)::operator()(std::__1::pair<int, int>) const + 275
6   com.Ark.Oni                   0x00000001207e09c4 std::__1::shared_ptr<Oni::Task> Oni::Parallel<Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float)::'lambda'(std::__1::pair<int, int>)>(Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float)::'lambda'(std::__1::pair<int, int>)&&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<Oni::Task> const&, int) + 84
7   com.Ark.Oni                   0x00000001207df140 Oni::CookedConstraintBatch<Oni::DistanceConstraintData>::EvaluateGaussSeidel(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>*, float) + 736
8   com.Ark.Oni                   0x000000012080bd37 std::__1::shared_ptr<Oni::Task> Oni::Parallel<Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>::EvaluateGaussSeidel(float)::'lambda'(std::__1::pair<int, int>)>(Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>::EvaluateGaussSeidel(float)::'lambda'(std::__1::pair<int, int>)&&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<Oni::Task> const&, int) + 119
9   com.Ark.Oni                   0x000000012080b555 Oni::BatchedConstraintGroup<Oni::DistanceConstraintData>::EvaluateGaussSeidel(float) + 149
10  com.Ark.Oni                   0x000000012082c7b9 Oni::ConstraintGroupBase::Apply(float) + 425
11  com.Ark.Oni                   0x0000000120815ccc Oni::Solver::ProjectConstraints(float) + 508
12  com.Ark.Oni                   0x00000001207d13c1 Oni::Task::Perform() + 305
13  com.Ark.Oni                   0x00000001207e2227 std::__1::__thread_proxy<std::__1::tuple<Oni::TaskManager::TaskManager(unsigned int)::$_0> >(void*, void*) + 1047
14  libsystem_pthread.dylib       0x00007fff57c106c1 _pthread_body + 340
15  libsystem_pthread.dylib       0x00007fff57c1056d _pthread_start + 377
16  libsystem_pthread.dylib       0x00007fff57c0fc5d thread_start + 13

Hi!

Thanks for the report, will take a look and report back asap.
Reply
#9
(21-09-2018, 10:24 AM)josemendez Wrote: Hi!

Thanks for the report, will take a look and report back asap.

Hi guys! 

I'm facing similar issue. Any updates on this? My App that's deployed on an iOS device (iPad Pro 2018) would freeze/crash when it enters the scene with Obi Softbody.
Reply
#10
(09-07-2019, 08:34 AM)Kristabel Wrote: Hi guys! 

I'm facing similar issue. Any updates on this? My App that's deployed on an iOS device (iPad Pro 2018) would freeze/crash when it enters the scene with Obi Softbody.

Hi Kristabel,

Does it crash on iPad Pro 2018? We're currently investigating this issue, but we though it was exclusive to the A12 (iPad Pro 2019, iPhone XS, XR). At least we've been unable to reproduce it on any other device/platform.
Reply