Parcourir la source

HPCC-10917 - Prevent MP deadlock if broken socket on RANK_ALL

MP detects broken sockets and notifies receivers, however it
did not pass on the notification for receivers who were listening
on RANK_ALL.

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith il y a 11 ans
Parent
commit
2e47f86af9
1 fichiers modifiés avec 10 ajouts et 3 suppressions
  1. 10 3
      system/mp/mpcomm.cpp

+ 10 - 3
system/mp/mpcomm.cpp

@@ -1842,6 +1842,7 @@ bool CMPServer::recv(CMessageBuffer &mbuf, const SocketEndpoint *ep, mptag_t tag
         bool aborted;
         CMessageBuffer *result;
         const SocketEndpoint *ep;
+        SocketEndpoint closedEp; // used if receiving on RANK_ALL
         mptag_t tag;
         Cnfy(const SocketEndpoint *_ep,mptag_t _tag) { ep = _ep; tag = _tag; result = NULL; aborted=false; }
         bool notify(CMessageBuffer *msg)
@@ -1858,9 +1859,15 @@ bool CMPServer::recv(CMessageBuffer &mbuf, const SocketEndpoint *ep, mptag_t tag
             }
             return false;
         }
-        bool notifyClosed(SocketEndpoint &closedep) // called when connection closed
+        bool notifyClosed(SocketEndpoint &_closedEp) // called when connection closed
         {
-            if (ep&&ep->equals(closedep)) {
+            if (NULL == ep) { // ep is NULL if receiving on RANK_ALL
+                closedEp = _closedEp;
+                ep = &closedEp; // used for abort info
+                aborted = true;
+                return true;
+            }
+            else if (ep->equals(_closedEp)) {
                 aborted = true;
                 return true;
             }
@@ -1877,7 +1884,7 @@ bool CMPServer::recv(CMessageBuffer &mbuf, const SocketEndpoint *ep, mptag_t tag
         LOG(MCdebugInfo(100), unknownJob, "CMPserver::recv closed on notify");
         PrintStackReport();
 #endif
-        IMP_Exception *e=new CMPException(MPERR_link_closed,*ep);
+        IMP_Exception *e=new CMPException(MPERR_link_closed,*nfy.ep);
         throw e;
     }
     return false;