浏览代码

HPCC-23593 eclccserver blocks when others might be available

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 年之前
父节点
当前提交
af7a5bc189
共有 3 个文件被更改,包括 18 次插入0 次删除
  1. 6 0
      ecl/eclccserver/eclccserver.cpp
  2. 11 0
      system/jlib/jthread.cpp
  3. 1 0
      system/jlib/jthread.hpp

+ 6 - 0
ecl/eclccserver/eclccserver.cpp

@@ -652,6 +652,12 @@ public:
         {
             try
             {
+                if (!pool->waitAvailable(10000))
+                {
+                    if (globals->getPropInt("@traceLevel", 0) > 2)
+                        DBGLOG("Blocked for 10 seconds waiting for an available compiler thread");
+                    continue;
+                }
                 Owned<IJobQueueItem> item = queue->dequeue();
                 if (item.get())
                 {

+ 11 - 0
system/jlib/jthread.cpp

@@ -1318,6 +1318,17 @@ public:
     {
         traceStartDelayPeriod = secs;
     }
+    bool waitAvailable(unsigned timeout)
+    {
+        if (!defaultmax)
+            return true;
+        if (availsem.wait(timeout))
+        {
+            availsem.signal();
+            return true;
+        }
+        return false;
+    }
 };
 
 

+ 1 - 0
system/jlib/jthread.hpp

@@ -243,6 +243,7 @@ interface IThreadPool : extends IInterface
         virtual PooledThreadHandle startNoBlock(void *param)=0; // starts a new thread if it can do so without blocking, else throws exception
         virtual PooledThreadHandle startNoBlock(void *param,const char *name)=0;    // starts a new thread if it can do so without blocking, else throws exception
         virtual void setStartDelayTracing(unsigned secs) = 0;        // set start delay tracing period
+        virtual bool waitAvailable(unsigned timeout) = 0;            // wait until a pool member is available
 };
 
 extern jlib_decl IThreadPool *createThreadPool(