Browse Source

HPCC-26814 Avoid potential race condition in ~CReceiveManager

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 3 years ago
parent
commit
42d701a3f7
1 changed files with 12 additions and 2 deletions
  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();
+            }
         }
     }