fix: Infinite hang when MPI process crashes#4001
Open
Conversation
MelReyCG
approved these changes
Mar 18, 2026
Member
|
The second call to to avoid cleanup issues. Are you sure this doesn't reintroduce the issues that it fixed? |
MelReyCG
requested changes
Mar 19, 2026
Contributor
There was a problem hiding this comment.
Ok, so let's change the strategy:
- separate anything that is not about cleaning up from
basicCleanup()to a new function (finalizeRun()? something else?), - ensure to call
basicCleanup()in any scenario, to ensure it is called, but any logging of a potencial error must be done before.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes GEOSX shutdown/cleanup behavior to avoid an infinite MPI hang when a rank crashes after throwing a GEOS exception, by threading an inError flag through cleanup/finalization and adjusting MPI finalization behavior.
Changes:
- Add an
inErrorparameter tobasicCleanup,cleanupEnvironment,finalizeMPI, andMpiWrapper::finalizeto distinguish normal vs. error shutdown. - Avoid normal MPI finalization/reporting on error paths (terminate via the error handler instead) to prevent collective/finalize hangs.
- Update main entrypoints and a broad set of unit/integration tests to use the new cleanup signatures.
Reviewed changes
Copilot reviewed 88 out of 88 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pygeosx/pygeosx.cpp | Update Python finalize path to call basicCleanup(false). |
| src/main/main.cpp | Add memory stats report on normal exit and pass inError to cleanup; adjust exception paths. |
| src/coreComponents/physicsSolvers/fluidFlow/unitTests/testFlowStatistics.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/physicsSolvers/fluidFlow/kernels/singlePhase/unitTests/testSinglePhaseMobilityKernel.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp | Update MPI finalize call signature to finalize(false). |
| src/coreComponents/mainInterface/initialization.hpp | Change basicCleanup API to basicCleanup(bool inError) and document param. |
| src/coreComponents/mainInterface/initialization.cpp | Wire basicCleanup(inError) to cleanupEnvironment(inError). |
| src/coreComponents/linearAlgebra/utilities/unitTests/testLAIHelperFunctions.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/linearAlgebra/unitTests/testLinearAlgebraUtils.hpp | Update cleanupEnvironment(false) usage in test scope destructor. |
| src/coreComponents/integrationTests/xmlTests/testXMLFile.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/xmlTests/testXML.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testThermalReservoirCompositionalMultiphaseSSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testThermalReservoirCompositionalMultiphaseMSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testReservoirSinglePhaseMSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testReservoirCompositionalMultiphaseMSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testIsothermalReservoirCompositionalMultiphaseSSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wellsTests/testIsothermalReservoirCompositionalMultiphaseMSWells.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationTaper.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationQ2.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationElasticVTI.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationElasticTTI.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationElasticFirstOrder.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationDG.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationDAS.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationAttenuationElastic.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationAttenuationAcousticVTI.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationAttenuationAcoustic.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationAdjoint1.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagationAcousticFirstOrder.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/wavePropagationTests/testWavePropagation.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/tableFunctionsFileTests/testTableFunctionsOutput.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/meshTests/testVTKImport.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/meshTests/testNeighborCommunicator.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/meshTests/testMeshGeneration.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/meshTests/testElementRegions.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testTransmissibility.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testThermalSinglePhaseFlow.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testThermalCompMultiphaseFlow.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseReactiveTransport.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testReactiveCompositionalMultiphaseOBL.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testImmiscibleMultiphaseFlow.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testFixedDimHydrostaticEquilibrium.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testCompMultiphaseFlowHybrid.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fluidFlowTests/testCompMultiphaseFlow.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fieldSpecificationTests/testRecursiveFieldApplication.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/fieldSpecificationTests/testAquiferBoundaryCondition.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/dataRepositoryTests/testRestartExtended.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/dataRepositoryTests/testRestartBasic.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/dataRepositoryTests/testGroupPath.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/constitutiveTests/testTriaxial.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/constitutiveTests/testRelPermHysteresis.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/constitutiveTests/testReactiveFluid.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/integrationTests/constitutiveTests/testPVT.cpp | Update integration test cleanup call to basicCleanup(false). |
| src/coreComponents/functions/unitTests/testFunctions.cpp | Update commented-out cleanup call to new signature. |
| src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/finiteElement/elementFormulations/unitTests/testConformingVirtualElementOrder1.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/fileIO/timeHistory/unitTests/testHDFParallelFile.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/fileIO/timeHistory/unitTests/testHDFFile.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/denseLinearAlgebra/unitTests/testBlasLapack.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/dataRepository/unitTests/testWrapperHelpers.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/dataRepository/unitTests/testObjectCatalog.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testTwoPhaseImmiscibleFluid.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testMultiFluidTwoPhaseCompositionalMultiphase.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testMultiFluidThreePhaseCompositionalMultiphase.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testMultiFluidDeadOil.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testMultiFluidCO2Brine.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testMultiFluidBlackOil.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testInverseCapillaryPressure.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testCO2SpycherPruessModels.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/unitTests/testCO2BrinePVTModels.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/constitutive/relativePermeability/unitTests/testRelPerm.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/constitutive/capillaryPressure/unitTests/testCapillaryPressure.cpp | Update test cleanup call to basicCleanup(false). |
| src/coreComponents/common/unitTests/testMpiWrapper.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/common/initializeEnvironment.hpp | Update finalizeMPI/cleanupEnvironment APIs to accept inError. |
| src/coreComponents/common/initializeEnvironment.cpp | Thread inError through environment cleanup and MPI finalize; remove memory report from cleanup. |
| src/coreComponents/common/format/table/unitTests/testMpiTable.cpp | Update test environment cleanup call to cleanupEnvironment(false). |
| src/coreComponents/common/MpiWrapper.hpp | Update MPI finalize API to finalize(bool inError) and document param. |
| src/coreComponents/common/MpiWrapper.cpp | Implement finalize(bool) to skip MPI_Finalize() on error and terminate via error handler. |
| src/coreComponents/codingUtilities/tests/testParallelTestUtilities.cpp | Update test cleanup call to basicCleanup(false). |
MelReyCG
requested changes
Mar 27, 2026
MelReyCG
approved these changes
Mar 30, 2026
…ss-wait-crash-mpi
MelReyCG
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug occurs when you launch a simulation with multiple ranks and one of the ranks calls a GEOS_THROW. This results in an infinite hang