Blender freezes in multi-threaded tasks since recent rB98123ae91680, on windows - atomic ops issue? #48422
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#48422
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Win 7x64, Nvidia GTX 580
Blender Version
broken: blender-2.77.0-git.b72aef9-AMD64
Working: blender-2.77.0-git.898d040-AMD64
Blender freezes while trying to do vertex snapping with subdivision modifier enabled both in object and edit mode.
Sometimes i can reproduce this instantly, sometime not, so try open attached file, it freezes all the time.
bug.blend
Changed status to: 'Open'
Added subscriber: @DenisBelov
#48432 was marked as duplicate of this issue
#48442 was marked as duplicate of this issue
#48440 was marked as duplicate of this issue
#48437 was marked as duplicate of this issue
Added subscriber: @ideasman42
This is caused by
98123ae916
Added subscriber: @mont29
Cannot reproduce that here… @ideasman42 you just opened the file and did some snapped transform in Object or Edit mode, and got the freeze?
Anyway, if this commit causes issues, it can be reverted, gave nearly no speed gain anyway…
Added subscriber: @mano-wii
I don't like to revert optimizations (no matter how small) :(
@mont29 if the first time has not frozen, try again, there are times when it works.
(Just make the snap to vertices in object mode. Edit mode also freezes)
I tried it several times of course, with both release and debug builds. Am on linux though, not sure on which OS Campbell reproduced it.
I do found an error in new code that could create issues, committed a fix, please give it a try. :)
ops, saying to "try again" I meant close and open Blender (but you also must have already tried this way).
At first, it seemed that was fixed. But the problem came back on the second try :( (no fix)
Still cannot reproduce at all…
Might be related to #48437, can you please try and see if you can reproduce it?
Yes I can reproduce it.
And the race condition also occurs in the loop "while (UNLIKELY(previter != olditer)".
I found a strange thing - after the end of the loop execution, suddenly, out of nowhere, it runs again without passing by the expected sequence of the function.
(I do not understand this atomic thing however)
Grumph… atomic means the operation is done in 'a single step' from CPU point of view, i.e. you cannot have thread 1 start an atomic operation, then thread 2 modify one of its operands, then thread 1 finish the operation.
Those atomic ops are implemented in all modern CPUs, and are much cheaper than using regular thread synchronization primitives like mutex or spinlock.
That looping func is a way to perform an operation that does not exists in atomic primitives, idea is to:
The atomic CAS (compare and swap) compares the value of the data to modify with a given 'reference', only sets the former with the new value if it equals to the reference value, and then return the old value of modified data.
So in theory, this is perfectly safe and no deadlock should happen. Actually, there is no actual deadlock possible here, since there is no lock - I’d rather think of an inifite loop due to something messed up in msvc version of our atomic primitives.
I would suspect some stupid conversion mismatch between signed and unsigned integers (though afaik uint32 < INT_MAX should not be an issue here :| ).
Can you please try to replace line 76 of
intern/atomic/intern/atomic_ops_msvc.h
file with that one, and check again?(I'm still trying to understand all the explanation ...)
However did the change you requested (line 76 of atomic_ops_msvc.h), and the problem persists :(
Guess I’ll have to go and debug this myself on my win VM (provided blender still runs on it), looks like our win atomics is broken somehow (unless I miss something else, maybe we'd need some kind of memory fence here, not sure why or where though)…
Added subscribers: @VertexPainter, @Ace_Dragon
Blender freezes while trying to do vertex snapping with subdivision modifier enabled.to Blender freezes in multi-threaded tasks since recent rB98123ae91680, on windows - atomic ops issue?Added subscribers: @Clarkx, @MassimilianoPuliero
This issue was referenced by
bb7da630ba
Changed status from 'Open' to: 'Resolved'