Skip to content

Ensure VTKHDF outputs are closed on simulation failures#189

Open
AhmedSalih3d wants to merge 1 commit into
BeforeLidDrivenCavityExamplefrom
codex/fix-vtkhdf-file-closure-on-simulation-fail
Open

Ensure VTKHDF outputs are closed on simulation failures#189
AhmedSalih3d wants to merge 1 commit into
BeforeLidDrivenCavityExamplefrom
codex/fix-vtkhdf-file-closure-on-simulation-fail

Conversation

@AhmedSalih3d

Copy link
Copy Markdown
Owner

Motivation

  • Simulations that error (not via Ctrl+C) could leave VTKHDF files open because finalization was only triggered for exit/interrupt paths, so add a robust single-use finalizer to always close output on failure.

Description

  • Add a FinalizeOnce! helper in RunWithSimulationFinalizer! to ensure output finalization runs exactly once across normal exit, Ctrl+C, Julia exit, and ordinary exceptions (src/SPHCellList.jl).
  • Replace direct finalization calls in the atexit handler and interrupt path with FinalizeOnce! and add handling for non-interrupt exceptions that finalizes with log_status="failed" before rethrowing.
  • Add a regression test that invokes RunWithSimulationFinalizer! with a synthetic error and asserts close_files was called (test/runtests.jl).

Testing

  • Ran julia --project=. -e 'using SPHExample' which precompiled and loaded the package successfully.
  • Executed an inline test that calls RunWithSimulationFinalizer! with a forced error("boom") and verified the provided close_files was invoked (test passed).
  • Ran the full test suite with julia --project=. -e 'using Pkg; Pkg.test()' which exercised the new regression test but the overall test run failed due to a pre-existing unrelated failure in the time stepping test (Δt method signature mismatch).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant