Mantaflow problem when baking via Python API #75889

Closed
opened 2020-04-19 09:24:29 +02:00 by ichlubna · 7 comments

System Information
Operating system: Arch Linux

Blender Version
Broken: 2.82 and above including 2.90 alpha
Worked: before Mantaflow

Getting this error:

terminate called after throwing an instance of 'Manta::Error'
  what():  can't clean grid cache, some grids are still in use
Error raised in /home/sources/buildbot-x86_64-slave/linux_glibc217_x86_64_cmake/blender.git/extern/mantaflow/preprocessed/fluidsolver.cpp:33

when trying to bake practically anything with this Python script. The same happens when using:

bpy.ops.ptcache.bake_all(bake=True)

Uploaded testing project file. bakeTest.blend

**System Information** Operating system: Arch Linux **Blender Version** Broken: 2.82 and above including 2.90 alpha Worked: before Mantaflow Getting this error: ``` terminate called after throwing an instance of 'Manta::Error' what(): can't clean grid cache, some grids are still in use Error raised in /home/sources/buildbot-x86_64-slave/linux_glibc217_x86_64_cmake/blender.git/extern/mantaflow/preprocessed/fluidsolver.cpp:33 ``` when trying to bake practically anything with [this ](https://github.com/ichlubna/blenderScripts/blob/master/MISC/bakeAll.py) Python script. The same happens when using: > bpy.ops.ptcache.bake_all(bake=True) Uploaded testing project file. [bakeTest.blend](https://archive.blender.org/developer/F8482975/bakeTest.blend)
Author

Added subscriber: @ichlubna

Added subscriber: @ichlubna

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Added subscribers: @sebbas, @JacquesLucke

Added subscribers: @sebbas, @JacquesLucke
Member

I'm trying to debug this for too long now..

I did notice that sometimes a python script tries to free a solver, but does not. Applying P1371 helps to see when a solver is created and when destroying.

Steps without error:

  • Open File
  • Close File

Steps with error:

  • Open File
  • Execute Script
  • Close File (this is when the error happens)

bakeTest_modified.blend

The patch then generates this output:

Create s2
C++ solver created
Create s1
C++ solver created
Try Delete s2
Create s3
C++ solver created
Try Delete s3
Really Delete s3
C++ solver freed
Create s4
C++ solver created
Saved session recovery to '/tmp/quit.blend'
ERRROOOOOR!!!!!!!!!!
Aborting: can't clean grid cache, some grids are still in use

The most important part here is that it tries to delete s1, but 's1' in globals() fails in the generated script. I'm not sure at what level the issue is.

I find it a bit weird that we dump all these variables into a __main__ module. My current guess is that the script is executed with incorrect globals and locals and therefore s1 is not found. That could be solved by passing proper globals and locals dicts to python in callPythonFunction.

@sebbas, do you think I should investigate that further, or do you think the bug is something else?

I'm trying to debug this for too long now.. I did notice that sometimes a python script tries to free a solver, but does not. Applying [P1371](https://archive.blender.org/developer/P1371.txt) helps to see when a solver is created and when destroying. Steps without error: - Open File - Close File Steps with error: - Open File - Execute Script - Close File (this is when the error happens) [bakeTest_modified.blend](https://archive.blender.org/developer/F8516180/bakeTest_modified.blend) The patch then generates this output: ``` Create s2 C++ solver created Create s1 C++ solver created Try Delete s2 Create s3 C++ solver created Try Delete s3 Really Delete s3 C++ solver freed Create s4 C++ solver created Saved session recovery to '/tmp/quit.blend' ERRROOOOOR!!!!!!!!!! Aborting: can't clean grid cache, some grids are still in use ``` The most important part here is that it tries to delete `s1`, but `'s1' in globals()` fails in the generated script. I'm not sure at what level the issue is. I find it a bit weird that we dump all these variables into a `__main__` module. My current guess is that the script is executed with incorrect `globals` and `locals` and therefore `s1` is not found. That could be solved by passing proper `globals` and `locals` dicts to python in `callPythonFunction`. @sebbas, do you think I should investigate that further, or do you think the bug is something else?

Added subscriber: @gabrign

Added subscriber: @gabrign

This issue was referenced by blender/blender@a50c131a0d

This issue was referenced by blender/blender@a50c131a0d71d04915cc39c5a412f4f16c6f706b
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jacques Lucke self-assigned this 2020-05-12 12:18:48 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 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-addons#75889
No description provided.