microsoft / microsoft/monaco-editor

[Bug] Rapid pasting raises a `Canceled: Canceled` exception

Open
#4,776 5 comments 4 reactions 1 assignee View on GitHub

@hediet is already working on this.

Since Dec 16, 2024.

bug
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

It is reproducible in monaco playground, but the actual monaco code is immaterial. You can use the default https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#example-creating-the-editor-hello-world

Monaco Editor Playground Code

Reproduction Steps

At the preview pane, copy some text with Ctrl+C and then repeatedly paste by holding down Ctrl+V:

Image

Actual (Problematic) Behavior

Don't mind the clipboard-CORS permission issue. The monaco related problem is evident in the stack:

async.ts:28  Uncaught (in promise) Canceled: Canceled
    at UniqueContainer.value (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:51766:24)
    at Emitter._deliver (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12271:26)
    at Emitter._deliverQueue (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12282:22)
    at Emitter.fire (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12305:22)
    at MutableToken.cancel (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12686:35)
    at CancellationTokenSource.cancel (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:12733:29)
    at Object.cancel (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:51780:24)
    at CopyPasteController.handlePaste (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:174859:42)
    at HTMLDivElement.<anonymous> (https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/dev/vs/editor/editor.main.js:174757:91)
Expected Behavior

No exception.

Additional Context

This exception is often encountered in compiler-explorer sentry logs. Currently reported here: https://github.com/compiler-explorer/compiler-explorer/issues/7181

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.