]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixed deadlock. 9121/head
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 2 Dec 2019 17:32:50 +0000 (18:32 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 2 Dec 2019 19:58:52 +0000 (20:58 +0100)
include/deal.II/base/mpi.h

index 9af1832740e15a0ef12c351618194b81346edf9b..5b3dbc87f6fa6b64127b37c7e49cef312ec0fb5a 100644 (file)
@@ -1500,13 +1500,16 @@ namespace Utilities
         else
           send_to.emplace_back(m.first);
 
-      // Shortcut, when running in serial
-      if (send_to.size() == 0)
-        return received_objects;
-
       const auto n_point_point_communications =
         Utilities::MPI::compute_n_point_to_point_communications(comm, send_to);
 
+      // If we have something to send, or we expect something from other
+      // processors, we need to visit one of the two scopes below. Otherwise,
+      // no other action is required by this mpi process, and we can safely
+      // return.
+      if (send_to.size() == 0 && n_point_point_communications == 0)
+        return received_objects;
+
       // Protect the following communication:
       static CollectiveMutex      mutex;
       CollectiveMutex::ScopedLock lock(mutex, comm);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.