Ver código fonte

Merge pull request #15572 from ghalliday/issue26814

HPCC-26814 Avoid potential race condition in ~CReceiveManager

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 3 anos atrás
pai
commit
3efcadcc96
1 arquivos alterados com 12 adições e 2 exclusões
  1. 12 2
      roxie/udplib/udptrr.cpp

+ 12 - 2
roxie/udplib/udptrr.cpp

@@ -819,8 +819,18 @@ class CReceiveManager : implements IReceiveManager, public CInterface
     {
         while(running) 
         {
-            DataBuffer *dataBuff = input_queue->pop(true);
-            collatePacket(dataBuff);
+            try
+            {
+                DataBuffer *dataBuff = input_queue->pop(true);
+                collatePacket(dataBuff);
+            }
+            catch (IException * e)
+            {
+                //An interrupted semaphore exception is expected at closedown - anything else should be reported
+                if (!dynamic_cast<InterruptedSemaphoreException *>(e))
+                    EXCLOG(e);
+                e->Release();
+            }
         }
     }