Commit 289b888d authored by Evan W. Patton's avatar Evan W. Patton

Fix infinite loop when connecting companion

A user reported an issue with a project where connecting the companion
caused the ReplMgr to go into an infinite loop. The issue was due to a
combination of setter block having an empty socket (triggering an
error resulting in the slow path) and the fact that there were more
than 20 top-level blocks in the project. After testing the first 20
blocks it would attempt the fast path, which would retrigger the slow
path, ad infinitum.

This commit updates the countdown in the slow path to use the number
of top-level blocks in the workspace rather than hard-coding 20
checks.

Fixes #887

Change-Id: Ie15b0f35cd145ecc0b789707f032eca6c179d107
parent 645eb86f
......@@ -675,7 +675,9 @@ Blockly.ReplMgr.processRetvals = function(responses) {
// We had an error in initial form load or at another
// time when we were chunking forms together
top.loadAll = false;
top.loadAllErrorCount = 20;
// This was 20, but for large projects it lead to infinite loops trying to
// find an error if the error occurs below a top level block at index > 20.
top.loadAllErrorCount = Blockly.mainWorkspace.getTopBlocks().length;
console.log("Error in chunking, disabling.");
this.resetYail(true);
this.pollYail(Blockly.mainWorkspace);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment