소스 검색

Merge pull request #3395 from jakesmith/thread-start-retry

HPCC-7886 Issue warnings and retry on thread start timeout

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 년 전
부모
커밋
f91ae19827
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      system/jlib/jthread.cpp

+ 9 - 2
system/jlib/jthread.cpp

@@ -377,8 +377,15 @@ void Thread::startRelease()
         ERRLOG("Running threads:\n %s",s.str());
         throw MakeOsException(status);
     }
-    if (!starting.wait(1000*10))
-        throw MakeStringException(-1, "Thread::start(%s) failed",getName());
+    unsigned retryCount = 10;
+    loop
+    {
+        if (starting.wait(1000*10))
+            break;
+        else if (0 == --retryCount)
+            throw MakeStringException(-1, "Thread::start(%s) failed", getName());
+        WARNLOG("Thread::start(%s) stalled, waiting to start, retrying", getName());
+    }
 #endif
     alive = true;
     if (prioritydelta)