monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] Getting `Canceled: Canceled` error when disposing the editor

Open jurgenwerk opened this issue 9 months ago • 1 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [x] Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code


Reproduction Steps

No response

Actual (Problematic) Behavior

We are experiencing an issue when disposing monaco editors when running a QUnit test.

I'm using Ember.js and this is in my component:

registerDestructor(this, async () => {
  let editor = this.monacoState?.editor;
  if (editor) {
    editor.dispose();
  }
});

When component gets destroyed, registerDestructor will be called and this is where we dispose of the editor. This worked fine in 0.33.0 but now that I upgraded to 0.52.2., I am receiving an error in my QUnit component test where I am rendering a monaco editor.

There must be a timing issue because if I add a small delay at the end of my test, or at the end of my registerDestructor, then the error will not happen.

stack: >
            Canceled: Canceled
                at Delayer.cancel (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:237183:23)
                at Delayer.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:237192:10)
                at dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245841:13)
                at DisposableStore.clear (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245923:7)
                at DisposableStore.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245907:10)
                at WordHighlighter.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:388991:19)
                at WordHighlighterContribution.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:389044:29)
                at dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245841:13)
                at DisposableMap.clearAndDisposeAll (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:246082:7)
                at DisposableMap.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:246072:10)
                at dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245841:13)
                at DisposableStore.clear (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245923:7)
                at DisposableStore.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245907:10)
                at CodeEditorContributions.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245984:17)
                at dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245841:13)
                at DisposableStore.clear (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245923:7)
                at DisposableStore.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245907:10)
                at StandaloneEditor.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:245984:17)
                at StandaloneEditor.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:2[821](https://github.com/cardstack/boxel/actions/runs/14059476194/job/39366512451?pr=2338#step:12:822)84:11)
                at StandaloneEditor.dispose (http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:391795:11)
                at http://localhost:7357/assets/chunk.d02b4ddf827a71f02c1e.js:463290:17
                at invoke (http://localhost:7357/assets/vendor.js:39370:16)
                at Queue.flush (http://localhost:7357/assets/vendor.js:39286:13)
                at DeferredActionQueues.flush (http://localhost:7357/assets/vendor.js:39440:21)
                at Backburner._end (http://localhost:7357/assets/vendor.js:39868:34)
                at Backburner.end (http://localhost:7357/assets/vendor.js:39671:12)
                at Backburner._run (http://localhost:7357/assets/vendor.js:39912:16)
                at Backburner._join (http://localhost:7357/assets/vendor.js:39889:21)
                at Backburner.join (http://localhost:7357/assets/vendor.js:39711:19)
                at join (http://localhost:7357/assets/vendor.js:25723:24)
                at ApplicationInstance.destroy (http://localhost:7357/assets/vendor.js:9891:27)
                at ApplicationInstance.superWrapper [as destroy] (http://localhost:7357/assets/vendor.js:10529:22)
                at ensureDestroyCalled (http://localhost:7357/assets/vendor.js:17744:16)
                at http://localhost:7357/assets/vendor.js:26713:45
                at iterate (http://localhost:7357/assets/vendor.js:26635:7)
                at destroy (http://localhost:7357/assets/vendor.js:26713:5)
                at iterate (http://localhost:7357/assets/vendor.js:26635:7)
                at destroy (http://localhost:7357/assets/vendor.js:26712:5)
                at http://localhost:7357/assets/chunk.d02b4ddf[827](https://github.com/cardstack/boxel/actions/runs/14059476194/job/39366512451?pr=2338#step:12:828)a71f02c1e.js:508416:64
        message: >
            global failure: Canceled: Canceled
```

### Expected Behavior

_No response_

### Additional Context

Monaco version: 0.52.2. 

jurgenwerk avatar Mar 25 '25 13:03 jurgenwerk

Looks like this is the same thing as #4702

meshantz avatar Apr 07 '25 13:04 meshantz