Skip to content

Viewport change events causing out of memory error #4916

@BeksOmega

Description

@BeksOmega

Describe the bug

If you jiggle the workspace too much, it can cause the tab to crash with an out of memory error.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the advanced playground
  2. Open up the console so that the browser will pause before crashing.
  3. Jiggle the workspace around rapidly.
  4. Observe how after a few seconds the browser will pause with a warning that it is about to run out of memory.

Expected behavior

No crashes. Not sure how to achieve that though.

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Browser: Chrome
  • Version: 91

Stack Traces

Here is the stack trace I get when it pauses:

e.getLineFeedCnt (pieceTreeBase.ts:928)
e.createNewPieces (pieceTreeBase.ts:1047)
e.insert (pieceTreeBase.ts:740)
e._doApplyEdits (pieceTreeTextBuffer.ts:412)
e.applyEdits (pieceTreeTextBuffer.ts:275)
o._applyEdits (textModel.ts:1147)
o.applyEdits (textModel.ts:1134)
e.pushEditOperation (editStack.ts:168)
o._pushEditOperations (textModel.ts:1127)
o.pushEditOperations (textModel.ts:1036)
generate (index.js:169)
S (index.js:226)
(anonymous) (index.js:335)
Blockly.Workspace.fireChangeListener (workspace.js:670)
Blockly.Events.fireNow_ (events.js:262)
--- setTimeout (async) ---
Blockly.Events.fire (events.js:244)
Blockly.WorkspaceSvg.maybeFireViewportChangeEvent (workspace_svg.js:1260)
Blockly.WorkspaceSvg.translate (workspace_svg.js:1288)
Blockly.WorkspaceSvg.scroll (workspace_svg.js:2312)
Blockly.WorkspaceDragger.drag (workspace_dragger.js:102)
Blockly.Gesture.handleMove (gesture.js:539)
Blockly.TouchGesture.handleMove (touch_gesture.js:169)
wrapFunc (browser_events.js:64)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions