[bugfix] Prevent segmentation fault for unkown keywords in parallel.

If there are unknown keywords and the parser throws an exception
then we nevertheless broadcasted the eclipseState and schedule.
Unfortunately, these might be null pointers in this case and
the serializer will run into a segmentation fault (e.g. when
serializing the non-existent TableManager)

Broadcasting is now only done if parsing was successful.
This commit is contained in:
Markus Blatt 2021-09-01 17:08:38 +02:00
parent fcdb4c33ea
commit edd6c6fe85

View File

@ -324,10 +324,18 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
eclipseState = std::make_unique<Opm::ParallelEclipseState>();
}
// In case of parse errors eclipseState/schedule might be null
// and trigger segmentation faults in parallel during broadcast
// (e.g. when serializing the non-existent TableManager)
auto comm = Dune::MPIHelper::getCollectiveCommunication();
parseSuccess = comm.min(parseSuccess);
try
{
if (parseSuccess)
{
Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig);
}
}
catch(const std::exception& broadcast_error)
{
failureMessage = broadcast_error.what();
@ -344,8 +352,6 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
errorGuard->clear();
}
auto comm = Dune::MPIHelper::getCollectiveCommunication();
parseSuccess = comm.min(parseSuccess);
if (!parseSuccess)