Explorar o código

Merge pull request #15572 from ghalliday/issue26814

HPCC-26814 Avoid potential race condition in ~CReceiveManager

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman %!s(int64=3) %!d(string=hai) anos
pai
achega
3efcadcc96
Modificáronse 1 ficheiros con 12 adicións e 2 borrados
  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();
+            }
         }
     }