blender crashes when add a inverse kineatics constraint to bone #49899

Closed
opened 2016-11-01 01:28:12 +01:00 by Jean Da Costa · 15 comments

when added a inverse kinematics to a bone it causes a crash.

my OS:
windows 7 ultimate x86
processor: amd phenon 9500 quadcore 2.21GH
nvidia geforce 6050SE nforce 430

blender version:
blender 2.78a hash e8299c8

the bug not is happening in previous versions.

steps
open blender, delete defaut cube and add a single bone, go to edit mode, extrude the bone tree times and duplicate the last bone, unparent it, go to pose mode and add a inferse kinematic constraint setup, uncheck use tail opition, and it will crash blender.

or simply enable auto IK and try editing the pose.

this file crashed blender all times:

console screenshot on exact moment of crash:
vlcsnap-2016-11-02-17h19m47s941.png
crash.blend
https://www.youtube.com/watch?v=yce51lIKgvU&feature=youtu.be

sory my bad english.

when added a inverse kinematics to a bone it causes a crash. my OS: windows 7 ultimate x86 processor: amd phenon 9500 quadcore 2.21GH nvidia geforce 6050SE nforce 430 blender version: blender 2.78a hash e8299c8 the bug not is happening in previous versions. steps open blender, delete defaut cube and add a single bone, go to edit mode, extrude the bone tree times and duplicate the last bone, unparent it, go to pose mode and add a inferse kinematic constraint setup, uncheck use tail opition, and it will crash blender. or simply enable auto IK and try editing the pose. this file crashed blender all times: console screenshot on exact moment of crash: ![vlcsnap-2016-11-02-17h19m47s941.png](https://archive.blender.org/developer/F390961/vlcsnap-2016-11-02-17h19m47s941.png) [crash.blend](https://archive.blender.org/developer/F389914/crash.blend) https://www.youtube.com/watch?v=yce51lIKgvU&feature=youtu.be sory my bad english.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @jeacom

Added subscriber: @jeacom

#50033 was marked as duplicate of this issue

#50033 was marked as duplicate of this issue
Jean Da Costa changed title from blender crashes when add a inverse kineatics constraint is added to bone to blender crashes when add a inverse kineatics constraint to bone 2016-11-02 15:05:15 +01:00
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

I could not reproduce maybe an 32-bit thing?

I could not reproduce maybe an 32-bit thing?
Member

Added subscribers: @Sergey, @LazyDodo

Added subscribers: @Sergey, @LazyDodo
Member

It's a mem alignment issue in bf_intern_iksolver, none of the classes care about their alignment, yet they use eigen which really wants them to be aligned at 16 byte boundaries (for vectorization reasons) , this can be fixed by overriding the class new and delete operators like this

	void* operator new(size_t i)
	{
		return _mm_malloc(i, 16);
	}

	void operator delete(void* p)
	{
		_mm_free(p);
	}

But it feels a little dirty to cut / paste that all over the place? Given this is not the only place in blender plagued by this (ge_phys_bullet ge_converter and bf_intern_libmv emit similar warnings, for at total of 20+ classes in blender that have this issue ), Bullet is by far the worst offender, and in never versions they solved it with a macro like this

http://www.letworyinteractive.com/blendercode/d0/d6b/btScalar_8h.html#a0bd5b84db13a000ac43fffe2bfc32187

Sergey, what's the preferred way of addressing this in blender?

It's a mem alignment issue in bf_intern_iksolver, none of the classes care about their alignment, yet they use eigen which really wants them to be aligned at 16 byte boundaries (for vectorization reasons) , this can be fixed by overriding the class new and delete operators like this ``` void* operator new(size_t i) { return _mm_malloc(i, 16); } void operator delete(void* p) { _mm_free(p); } ``` But it feels a little dirty to cut / paste that all over the place? Given this is not the only place in blender plagued by this (ge_phys_bullet ge_converter and bf_intern_libmv emit similar warnings, for at total of 20+ classes in blender that have this issue ), Bullet is by far the worst offender, and in never versions they solved it with a macro like this http://www.letworyinteractive.com/blendercode/d0/d6b/btScalar_8h.html#a0bd5b84db13a000ac43fffe2bfc32187 Sergey, what's the preferred way of addressing this in blender?

We can have something similar, yes.

Did you check if using aligned attribute on class and/or property helps?

We can have something similar, yes. Did you check if using aligned attribute on class and/or property helps?
Member

It doesn't, it only really helps for things that are allocated at compile time the docs ( https://msdn.microsoft.com/en-us/library/83ythb65.aspx ) mention

Note that ordinary allocators—for example, malloc, C++ operator new, and the Win32 allocators—
return memory that is usually not sufficiently aligned for __declspec(align(#)) structures or arrays of structures. 
To guarantee that the destination of a copy or data transformation operation is correctly aligned, use _aligned_malloc, or write your own allocator.
It doesn't, it only really helps for things that are allocated at compile time the docs ( https://msdn.microsoft.com/en-us/library/83ythb65.aspx ) mention ``` Note that ordinary allocators—for example, malloc, C++ operator new, and the Win32 allocators— return memory that is usually not sufficiently aligned for __declspec(align(#)) structures or arrays of structures. To guarantee that the destination of a copy or data transformation operation is correctly aligned, use _aligned_malloc, or write your own allocator. ```

Hrm, so we'll need to do aligned-alloc for those classes. For that doing something what you showed should work (we should be able to use EIGEN_MAKE_ALIGNED_OPERATOR_NEW).

However, not sure that will be enough. Thing is, even object itself is aligned it doesn't mean its properties are aligned, so guess alignment attribute is still needed?

Hrm, so we'll need to do aligned-alloc for those classes. For that doing something what you showed should work (we should be able to use `EIGEN_MAKE_ALIGNED_OPERATOR_NEW`). However, not sure that will be enough. Thing is, even object itself is aligned it doesn't mean its properties are aligned, so guess alignment attribute is still needed?
Member

Judging from https://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html the eigen classes have aligned attributes on them, so the structure layout will be aligned at compile time. EIGEN_MAKE_ALIGNED_OPERATOR_NEW makes sure that whenever you new up a class it'll be aligned as well.

Judging from https://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html the eigen classes have aligned attributes on them, so the structure layout will be aligned at compile time. EIGEN_MAKE_ALIGNED_OPERATOR_NEW makes sure that whenever you new up a class it'll be aligned as well.
Ray molenkamp was assigned by Bastien Montagne 2016-11-04 10:09:53 +01:00

Added subscriber: @Almisuifre

Added subscriber: @Almisuifre
Member

Added subscriber: @SergeL

Added subscriber: @SergeL

This issue was referenced by 0de157a320

This issue was referenced by 0de157a3204206a5d0d90daa00e7c6648e3c9674
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#49899
No description provided.