Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 4 files). Show all
Unified · Split
| @@ -432,17 +432,18 @@ void ScriptManager::waitTillDoneRunning(bool shutdown) { · 431 unmodified lines | |||
| 432 | while (workerThread->isRunning()) { | 432 | while (workerThread->isRunning()) { |
| 433 | // If the final evaluation takes too long, then tell the script engine to stop running | 433 | // If the final evaluation takes too long, then tell the script engine to stop running |
| 434 | auto elapsedUsecs = usecTimestampNow() - startedWaiting; | 434 | auto elapsedUsecs = usecTimestampNow() - startedWaiting; |
| 435 | // V8TODO: temporarily increased script timeout. Maybe use different timeouts for release and unoptimized debug? | ||
| 435 | static const auto MAX_SCRIPT_EVALUATION_TIME = USECS_PER_SECOND; | 436 | static const auto MAX_SCRIPT_EVALUATION_TIME = USECS_PER_SECOND; |
| 436 | if (elapsedUsecs > MAX_SCRIPT_EVALUATION_TIME) { | 437 | if (elapsedUsecs > MAX_SCRIPT_EVALUATION_TIME) { |
| 437 | workerThread->quit(); | 438 | workerThread->quit(); |
| 438 | 439 | ||
| 439 | if (_engine->isEvaluating()) { | 440 | if (_engine->isEvaluating()) { |
| 440 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); | 441 | qCWarning(scriptengine) << "Script Engine has been running too long (evaluation), aborting:" << getFilename(); |
| 441 | _engine->abortEvaluation(); | 442 | _engine->abortEvaluation(); |
| 442 | } else { | 443 | } else { |
| 443 | auto context = _engine->currentContext(); | 444 | auto context = _engine->currentContext(); |
| 444 | if (context) { | 445 | if (context) { |
| 445 | qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | 446 | qCWarning(scriptengine) << "Script Engine has been running too long (event loop), throwing:" << getFilename(); |
| 446 | context->throwError("Timed out during shutdown"); | 447 | context->throwError("Timed out during shutdown"); |
| 447 | } | 448 | } |
| 448 | } | 449 | } |
| @@ -451,6 +452,7 @@ void ScriptManager::waitTillDoneRunning(bool shutdown) { · 2 unmodified lines | |||
| 451 | // flooding it with aborts/exceptions will persist it longer | 452 | // flooding it with aborts/exceptions will persist it longer |
| 452 | static const auto MAX_SCRIPT_QUITTING_TIME = 0.5 * MSECS_PER_SECOND; | 453 | static const auto MAX_SCRIPT_QUITTING_TIME = 0.5 * MSECS_PER_SECOND; |
| 453 | if (!workerThread->wait(MAX_SCRIPT_QUITTING_TIME)) { | 454 | if (!workerThread->wait(MAX_SCRIPT_QUITTING_TIME)) { |
| 455 | Q_ASSERT(false); | ||
| 454 | workerThread->terminate(); | 456 | workerThread->terminate(); |
| 455 | } | 457 | } |
| 456 | } | 458 | } |