Page MenuHome

Fluid: Crash with empty cache path
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows 10 Pro/Win 10 Home
Graphics card: NVIDIA GeForce GTX 1080/Intel HD620

Blender Version
Broken: 2.90.1

Short description of error
Entering an empty line in the cache directory path field causes the blender to crash.

Exact steps for others to reproduce the error

  1. Make start cube as 'Domain' for fluid
  2. On physics tab delete a path for cache directory (make this field empty)
  3. Click anywhere or press enter

This crash has been reproduced on three computers (Windows 10).

Best regards sincerely.

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from Developers.Sep 29 2020, 1:27 PM

Cannot reproduce on Linux (checked both 2.90.1 and rB32d4a67017ec)

**System Information**
Operating system: Linux-5.8.4-200.fc32.x86_64-x86_64-with-fedora-32-Thirty_Two 64 Bits
Graphics card: GeForce GTX 970M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 450.66
ersion: 2.91.0 Alpha, branch: master, commit date: 2020-09-29 07:53, hash: `rB32d4a67017ec`

Might be a Windows specific problem?

CC @Sebastián Barschkis (sebbas)

Richard Antalik (ISS) changed the task status from Needs Information from Developers to Needs Information from User.Oct 7 2020, 12:01 PM

Also can not reproduce.

Please click on Help > Save System Info and upload saved file. Download build from https://builder.blender.org/download/ and check if this problem persists.

If you set the path to empty and haven't previously saved the project, then it will attempt to create the cache folders in the directory of Blender's executable. If you've installed Blender to C:\Program Files\Blender Foundation then Blender likely doesn't have the required permissions to do so.

Robert Guetzkow (rjg) changed the task status from Needs Information from User to Confirmed.Nov 3 2020, 11:56 AM

I can confirm that this results in a crash @Sebastián Barschkis (sebbas)

Robert Guetzkow (rjg) triaged this task as High priority.Nov 3 2020, 11:59 AM
Jacques Lucke (JacquesLucke) changed the subtype of this task from "Report" to "Bug".Nov 3 2020, 12:57 PM

@Robert Guetzkow (rjg) so if you saved the project previously, does the problem still happen? Or even, if you save the project, but explicitly set the cache folder to one you can't write to. I cannot reproduce on Linux

Robert Guetzkow (rjg) added a comment.EditedNov 3 2020, 6:44 PM

@Dalai Felinto (dfelinto) It generally crashes when using a path that can't be accessed due to missing permissions, e.g. C:\Program Files.

BLI_gzopen(const unsigned char * filename, const unsigned char * mode) Line 366	C
MANTA::writeConfiguration(FluidModifierData * fmd, int framenr) Line 1118	C++
manta_write_config(MANTA * fluid, FluidModifierData * fmd, int framenr) Line 69	C++
BKE_fluid_modifier_processDomain(FluidModifierData * fmd, Depsgraph * depsgraph, Scene * scene, Object * ob, Mesh * me, const int scene_framenr) Line 4105	C
BKE_fluid_modifier_process(FluidModifierData * fmd, Depsgraph * depsgraph, Scene * scene, Object * ob, Mesh * me) Line 4146	C
BKE_fluid_modifier_do(FluidModifierData * fmd, Depsgraph * depsgraph, Scene * scene, Object * ob, Mesh * me) Line 4164	C
modifyMesh(ModifierData * md, const ModifierEvalContext * ctx, Mesh * me) Line 130	C
BKE_modifier_modify_mesh(ModifierData * md, const ModifierEvalContext * ctx, Mesh * me) Line 1011	C
mesh_calc_modifiers(Depsgraph * depsgraph, Scene * scene, Object * ob, int useDeform, const bool need_mapping, const CustomData_MeshMasks * dataMask, const int index, const bool use_cache, const bool allow_shared_mesh, Mesh * * r_deform, Mesh * * r_final) Line 1183	C
mesh_build_data(Depsgraph * depsgraph, Scene * scene, Object * ob, const CustomData_MeshMasks * dataMask, const bool need_mapping) Line 1806	C
makeDerivedMesh(Depsgraph * depsgraph, Scene * scene, Object * ob, BMEditMesh * em, const CustomData_MeshMasks * dataMask) Line 1927	C
BKE_object_handle_data_update(Depsgraph * depsgraph, Scene * scene, Object * ob) Line 194	C
BKE_object_eval_uber_data(Depsgraph * depsgraph, Scene * scene, Object * ob) Line 385	C
 	[Externer Code]	
blender::deg::`anonymous namespace'::evaluate_node(const blender::deg::`anonymous-namespace'::DepsgraphEvalState * state, blender::deg::OperationNode * operation_node) Line 116	C++
blender::deg::`anonymous namespace'::deg_task_run_func(TaskPool * pool, void * taskdata) Line 128	C++
Task::()::__l2::<Lambdafunktion>() Line 118	C++
tbb::interface7::internal::delegated_function<void <Lambdafunktion>(void) const ,void>::operator()() Line 94	C++
 	[Externer Code]	
tbb::interface7::internal::isolate_impl<void,void <Lambdafunktion>(void) const>(const Task::()::__l2::void <Lambdafunktion>(void) & f) Line 161	C++
tbb::interface7::this_task_arena::isolate<void <Lambdafunktion>(void)>(const Task::()::__l2::void <Lambdafunktion>(void) & f) Line 396	C++
Task::operator()() Line 122	C++
tbb::internal::function_task<Task>::execute() Line 1049	C++
 	[Externer Code]	
tbb::task::wait_for_all() Line 810	C++
tbb::internal::task_group_base::wait() Line 168	C++
tbb_task_pool_work_and_wait(TaskPool * pool) Line 253	C++
BLI_task_pool_work_and_wait(TaskPool * pool) Line 500	C++
blender::deg::deg_evaluate_on_refresh(blender::deg::Depsgraph * graph) Line 399	C++
deg_flush_updates_and_refresh(blender::deg::Depsgraph * deg_graph) Line 59	C++
DEG_evaluate_on_refresh(Depsgraph * graph) Line 74	C++
scene_graph_update_tagged(Depsgraph * depsgraph, Main * bmain, bool only_if_tagged) Line 1537	C
BKE_scene_graph_update_tagged(Depsgraph * depsgraph, Main * bmain) Line 1575	C
wm_event_do_depsgraph(bContext * C, bool is_after_open_file) Line 357	C
wm_event_do_refresh_wm_and_depsgraph(bContext * C) Line 384	C
wm_event_do_notifiers(bContext * C) Line 562	C
WM_main(bContext * C) Line 482	C
main(int argc, const unsigned char * * UNUSED_argv_c) Line 526	C

Assigning it to @Sebastián Barschkis (sebbas) then. I believe he has access to a Windows station. He should be able to reproduce it.

Sebastián Barschkis (sebbas) renamed this task from Crash with empty cache path to Fluid: Crash with empty cache path.Nov 7 2020, 1:01 PM

Don't have access to a Windows machine right now and would say this won't be fixed in 2.91.

@Robert Guetzkow (rjg) Sure, it would be interesting to know why BLI_gzopen() in MANTA::writeConfiguration gives a crash. If a file cannot be opened I would have expected to return false afterwards.

So this is rather a bug in BLI_gzopen() than it is in Mantaflow. It does the following on Windows to create the file:

/* xxx Creates file before transcribing the path */
if (mode[0] == 'w') {
  fclose(ufopen(filename, "a"));
}

This fails when the file can't be opened and ufopen returns NULL.

/* xxx Creates file before transcribing the path */
if (mode[0] == 'w') {
  FILE *file = ufopen(filename, "a");
  if (file == NULL) {
    /* File couldn't be opened, e.g. due to permission error. */
    return NULL;
  }
  fclose(file);
}

Mantaflow should probably display a warning/error to the user though when the cache directory can't be used. Currently it only writes a messages to the console.

@Robert Guetzkow (rjg) Looks good to me. As this fixes the crash (right?), from my side you could already commit this to 2.91.
I can add warnings etc. afterwards.