-
Notifications
You must be signed in to change notification settings - Fork 38.4k
Description
This is the underlying cause for the issue in microsoft/vscode-jupyter#15075. This issue details the problem fixed by #204417.
Currently, users can supply arbitrary numbers of kernels. Each kernel that's added gets a listener for onDidChangeSelectedNotebooks in order to properly associate the kernel with the notebook so it can be executed if it is switched to.
vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.ts
Lines 265 to 271 in 12904c6
| const listener = this._notebookKernelService.onDidChangeSelectedNotebooks(e => { | |
| if (e.oldKernel === kernel.id) { | |
| this._proxy.$acceptNotebookAssociation(handle, e.notebook, false); | |
| } else if (e.newKernel === kernel.id) { | |
| this._proxy.$acceptNotebookAssociation(handle, e.notebook, true); | |
| } | |
| }); |
The Emitter that is used for onDidChangeSelectedNotebooks is constructed with default settings.
vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.ts
Line 104 in 12904c6
| private readonly _onDidChangeNotebookKernelBinding = this._register(new Emitter<ISelectedNotebooksChangeEvent>()); |
If users have too many kernels, the threshold can be hit.
vscode/src/vs/base/common/event.ts
Lines 1016 to 1019 in 12904c6
| if (this._leakageMon && this._size > this._leakageMon.threshold * 3) { | |
| console.warn(`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far`); | |
| return Disposable.None; | |
| } |
When this happens, the kernel will show as selected in the UI, but will fail to execute because the kernel won't be able to properly associate with the notebook. See the vscode-jupyter issue referenced above for a demonstration of this.
- VS Code Version: Multiple VS Code versions, including current insiders
- OS Version: Present on Mac and Linux at least
Steps to Reproduce:
See microsoft/vscode-jupyter#15075 for reproducing details.