diff --git a/trikScriptRunner/src/trikJavaScriptRunner.cpp b/trikScriptRunner/src/trikJavaScriptRunner.cpp index 30bf4334..02e3c93c 100644 --- a/trikScriptRunner/src/trikJavaScriptRunner.cpp +++ b/trikScriptRunner/src/trikJavaScriptRunner.cpp @@ -66,7 +66,15 @@ TrikJavaScriptRunner::~TrikJavaScriptRunner() // The thread has finished, events have been processed above constexpr auto POLITE_TIMEOUT = 100; if (!mWorkerThread.wait(POLITE_TIMEOUT)) { - QLOG_FATAL() << "JS thread failed to exit gracefully in" << POLITE_TIMEOUT << "ms"; + QLOG_WARN() << "JS thread failed to exit gracefully in" << POLITE_TIMEOUT + << "ms, re-trying with 3x timeout"; + if (!mWorkerThread.wait(3*POLITE_TIMEOUT)) { + QLOG_ERROR() << "JS thread failed to exit gracefully in 3x timeout," + << " next attempt is unlimited timeout and may hang"; + mWorkerThread.wait(); + } else { + QLOG_INFO() << "JS thread succeeded to shutdown with 3x timeout"; + } } }