Page MenuHome

Crashing during animation with Geometry Nodes ( when clicked on Attribute Randomize - Attribute field )
Confirmed, HighPublicBUG

Description

Blender Version
Broken: version: 2.93, 3.0.0 Alpha, branch: master, commit date: 2021-06-18 21:33, hash: rBf9aea19d9890

Short description of error
Crashing during animation when using Geometry Nodes - when clicked on Attribute Randomize - Attribute field

Exact steps for others to reproduce the error
Open the file, start animation and click on the attribute search button:

OR:

Creating simple scene with an animation of rotating brush :

  • I added cylinder ( "Cylinder" ) with some loops cuts, assigned these loop cuts' vertices into vertex group ( "Group" ). Added one plane ( "Plane" ) with narrow size. Then Using Geometry Nodes on the "Cylinder" object with Point Instance ( Object = "Plane" ) + Point Distribute ( Density = "Group" ). Then I create keyframe on 0, then keyframe on 50 with cylinder rotation 180 deg, then keyframe on 100 with another rotation 180.
  • Then I start the animation and all works fine
  • Then I added Attribute Randomize into the Geometry Nodes for that Cylinder
  • When animation is stopped, all ok. But when animation is running and I click into Attribute Randomize -> Attribute field, it crashes ( tried 4 times )

Event Timeline

Petr Smrtka (Kmochy) updated the task description. (Show Details)

Thanks for the report. Can you please provide a simple .blend file?

Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Needs Information from User.Jun 21 2021, 5:15 AM

I can reproduce this with 2.93 and master. It crashes as soon as I go in the attribute search.

Dalai Felinto (dfelinto) changed the task status from Needs Information from User to Confirmed.Jun 21 2021, 4:08 PM
Dalai Felinto (dfelinto) updated the task description. (Show Details)

For the records this is the bracktrace (for the main thread): P2191

Interesting. It's use-after-free of the attribute hints. I think this is the cause:

  • The attribute search button is created and given pointers to the evaluated geometry set.
  • Animation starts, and the modifier re-evaluates, freeing the evaluated geometry set to replace it with the one for the next frame.
  • The node editor (and most of the UI) is not redrawn to improve animation playback performance, meaning the button points to a freed geometry set.
  • You click the search, button-- crash.

The most straightforward solution is probably to disable attribute search when animation is playing, but this must be a relatively common problem in the UI.
@Julian Eisel (Severin), is disabling the search generally the right approach?

I don't think it makes sense to disable attribute search. Although it seems harmless to do so now, it will be a problem when we have the physics clock detached from the animation clock.

Can't there just be a level of indirection, so the evaluated geometry set pointer isn't used directly? E.g. either the button gets a pointer to the pointer (so the latter can change without issues) or it gets the pointer to the owner (or the owning ID even) of the geometry set.

Just wanted to mention that tooltips are disabled as well when the animation is playing, not sure if the reasons are similar.

Hans Goudey (HooglyBoogly) triaged this task as High priority.Tue, Jul 20, 8:46 PM
Hans Goudey (HooglyBoogly) changed the subtype of this task from "Report" to "Bug".

Given the conversation above I don't know the best solution. Now that the node UI storage is stored on the modifier, at least attribute search works now, but it still crashes when you apply an attribute, because the underlying problem is the same-- AttributeSearchData has a pointer to an old node tree because the the UI isn't redrawn during animation.

AttributeSearchData has a pointer to an old node tree because the the UI isn't redrawn during animation.

Not quite true. The pointer to the tree is fine (it's original dna data), the pointer to the GeometryAttributeInfo is outdated after the modifier ran again.

Here is an alternative solution that does not quite work yet, but could work if we do a refactor in the ui code: P2277.
The idea is, instead of referencing GeometryAttributeInfo, we just copy it into the "state" of the search uibut. This way we can't get a dangling pointer.
The reason this does not work yet, is because the free function passed to UI_but_func_search_set does not work as intended yet. We should just get rid of all those argN stuff, and just always have arg and arg_free. This would give us much more flexibility with what we can put into a uiBut. Not sure how much of a refactor that would be.