From 504f5a8a146ff2f38d7027efb7dc698428b6bf90 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 16 Feb 2022 09:59:03 +0000 Subject: [PATCH] BUG: decomposeParDict: operate with masterUncollated. Fixes #2368. --- src/OpenFOAM/global/argList/argList.C | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 02741362dc..4485ce389b 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1354,7 +1354,9 @@ void Foam::argList::parse // Disable any parallel comms happening inside the fileHandler // since we are on master. This can happen e.g. inside - // the masterUncollated/collated handler. + // the masterUncollated/collated handler. Note that we + // also have to protect the actual dictionary parsing since + // it might trigger file access (e.g. #include, #codeStream) const bool oldParRun = Pstream::parRun(false); autoPtr dictStream @@ -1362,8 +1364,6 @@ void Foam::argList::parse fileHandler().NewIFstream(source) ); - Pstream::parRun(oldParRun); // Restore parallel state - if (dictStream && dictStream->good()) { dictionary decompDict(*dictStream); @@ -1412,6 +1412,8 @@ void Foam::argList::parse } } + Pstream::parRun(oldParRun); // Restore parallel state + if (Pstream::nProcs() == 1) { Warning