Page MenuHome

Blender 2.77 Crash When Rigid Body Cache 'Bake' Clicked
Closed, ResolvedPublic

Description

System Information
Operating system and graphics card
Dell Studio 1749 (64 bit)
Intel Core i5 CPU M 520 @ 2GHz 2 Cores, 4 Logical Processors
8.0 GB memory installed

MIcrosoft WIndows 10 Pro, ver 10.0.10586 Build 10586
ATI Mobility Radeon HD 5650
4 MB Graphics Memory

Blender Version
Broken: 2.77 - 22a2853
Worked: 2.76b f337fea

Short description of error
Have ~ 14,000 Rigid Body objects. When press Rigid Body Cache 'Bake' - Blender immediately crashes. No time to see error message if any.

**Exact steps for others to reproduce the error*
Create ~14,000 Rigid Body Ico Spheres (Active, Dynamic, Convex Hull, Base)
Save
Create animated mesh 'foot' (No armature or bones) (Dynamic, animated, Convex Hull Deform)
Save
Create 3D rectangular collision surface where Ico Spheres will land. (Passive, Convex Hull)
Save
During animation 'foot' walks across Ico Spheres leaving a track.

Press 'Rigid Body Cache' 'Bake'
Based on a (as simple as possible) attached .blend file with minimum amount of steps

Thanks! ... Blender is awesome!

Event Timeline

Bob Wise (BCTracker) set Type to Bug.
Bob Wise (BCTracker) created this task.
Bob Wise (BCTracker) raised the priority of this task from to Needs Triage by Developer.

I suggest that you attach a more lightweight sample file.

Lukas Toenne (lukastoenne) triaged this task as Confirmed, Medium priority.

Yes, this test file is unnecessarily big, the error still occurs with just one of the rigid bodies as well. That's why it says "as simple as possible" in the instructions!

That being said, the error seems to be a threading bug of the point cache. The Bake operator starts a job, which runs in the background until completed or cancelled. The operator meanwhile returns immediately. Now, when the operator returns, it triggers an undo push, which writes a .blend file containing the memory (non-disk) point cache data. Due to the pointcache implementation writing to the same data during bake, the file writing uses an undefined memory state, and can crash when attempting to access information about internal data arrays of the cache, which are still being set up in another thread at that point.
https://developer.blender.org/diffusion/B/browse/master/source/blender/blenloader/intern/writefile.c$1130

The point cache is considered broken in any case. Among lots of other issues, a job should not work on DNA data directly like this, but use separate data which only gets sync'd with DNA on completion. As a short term solution we could disable threading for point cache bake ...

Thanks both of you!

I can use Blender 2.76b for now, so no urgency, or need for special fix on my part.

Sorry file was unnecessarily bulky... would have simplified file more, but unsure what was causing problem so not certain what was safe to delete.

Would like to know when problem is fixed though so I can use new Blender version for this work.

I really appreciate Blender and all the work that's gone into it. Nothing like being able to demonstrate exactly what you see in your mind...something words just don't do!

See comment here rBbd0223b8fefe1bf21f9cd2b444256775b5540227, this change probably awakened the dormant race condition in point cache ...

The UI is locked during bake, so generally it should be thread safe, just this undo push slipped through.

I've now changed the bake operator to work like the render operator, it keeps running as a modal operator until the job is finished. That's also generally more correct, as we want all changes made by the bake job to be included in the undo push.