Skip to content

[Error] unhandlederror-potential listener LEAK detected, popular #319468

Closed

Description

@vs-code-engineering

Error Message

unhandlederror-potential listener LEAK detected, popular

Stack Trace

    at a.create (./src/vs/base/common/event.ts:1068:14)
    at Awe._event (./src/vs/base/common/event.ts:1272:33)
    at new Ge (./src/vs/base/common/cancellation.ts:103:42)
    at hle.doReadFileStream (./src/vs/platform/files/common/fileService.ts:596:0)
    at hle.readFileStream (./src/vs/platform/files/common/fileService.ts:583:0)
    at async vzo (./src/vs/workbench/contrib/webview/browser/resourceLoading.ts:83:17)
    at async Q5e.loadResource (./src/vs/workbench/contrib/webview/browser/webviewElement.ts:785:0)

Raw Stack Trace (minified)
Error     at a.create (out/vs/workbench/workbench.desktop.main.js:403:18439)     at Awe._event (out/vs/workbench/workbench.desktop.main.js:405:2009)     at new Ge (out/vs/workbench/workbench.desktop.main.js:405:31381)     at hle.doReadFileStream (out/vs/workbench/workbench.desktop.main.js:4998:91435)     at hle.readFileStream (out/vs/workbench/workbench.desktop.main.js:4998:91371)     at async vzo (out/vs/workbench/workbench.desktop.main.js:5362:12707)     at async Q5e.loadResource (out/vs/workbench/workbench.desktop.main.js:5362:27665)

Details

Property Value
Bucket ID 3ccb3805-b65f-97d2-4445-be6c2e5403c5
Version 1.122.1
Commit 8761a556
Last Seen Sun May 31 2026 23:59:44 GMT+0000 (Coordinated Universal Time)
Platforms Linux, Mac, Windows
Product VSCode

This issue was automatically created from the VS Code Errors Dashboard

Activity

  1. added
    bug
    error-telemetry
    on Jun 1, 2026
  2. bryanchen-d commented on Jun 1, 2026

    @bryanchen-d
    Collaborator

    Kyle Cutler (@kycutler), this is currently a top error bucket, it is signaling a leak from the browser/webviewElement.ts based on the callstack, can you take a look?

  3. kycutler commented on Jun 4, 2026

    @kycutler
    Collaborator

    This is for webviews, not browser -- cc Matt Bierner (@mjbvz)

  4. FinalePrestissimo commented on Jul 10, 2026

    @FinalePrestissimo

    I can connect this telemetry bucket to a reproducible user-visible failure: a WebView renderer ServiceWorker thread enters a persistent approximately 100% CPU loop and the VS Code window becomes unresponsive.

    Environment:

    • VS Code 1.128.0, commit fc3def6774c76082adf699d366f31a557ce5573f
    • macOS arm64, Electron 42.5.0, Chromium renderer 148.0.7778.271
    • Remote SSH 0.124.0
    • A third-party WebView extension running on one Linux Remote SSH authority

    I reproduced this twice in independent VS Code processes. Each used fresh and separate --user-data-dir, --shared-data-dir, and --extensions-dir directories, one remote authority, and one WebView, so old Service Worker state and multiple restored windows were not involved.

    In both runs:

    1. The WebView requested exactly 653 unique remote resources in one second (625 JS and 28 CSS).
    2. During that burst, the renderer logged potential listener LEAK detected, popular with the exact stack from this issue:
    event.ts / cancellation.ts
      -> fileService.doReadFileStream
      -> resourceLoading
      -> webviewElement.loadResource
    
    1. Five seconds later telemetry/UnhandledError reported listenerCount: 175, count: 6.
    2. The WebView renderer stayed near 100% CPU. In the first run, CodeWindow: detected unresponsive appeared about 28 seconds after the resource burst, followed by UnresponsiveSampleError.
    3. macOS process samples identified the direct hot thread as ServiceWorker thread: 3,807/3,823 samples in the first run and 2,291/2,295 in the second, in V8/Electron microtask/compiler paths (MicrotasksScope, CompilationDependencies, DependOnNoSlackTrackingChange).
    4. Terminating only the WebView renderer immediately stopped the CPU load and removed the Service Worker target.

    CDP target snapshots directly mapped the hot renderer to the extension WebView iframe and its version-5 vscode-webview Service Worker. The remote extension backend remained near idle.

    This suggests that the listener leak can be more than a telemetry-only error under high-fan-out Remote SSH WebView loads: it correlates with an actual Service Worker spin and a frozen workbench window. This also looks related to the streamed WebView resource path introduced by #311844.

    I retained sanitized renderer/main/telemetry logs, CDP target snapshots, process tables, and macOS samples if maintainers need a focused attachment. I have not proven that the transferable-stream branch specifically is the only failing branch.

  5. zhang-wenchao commented on Jul 13, 2026

    @zhang-wenchao

    This is related to the Codex extension not working; Hope this issue can be tracked.

  6. ozpavel commented on Jul 14, 2026

    @ozpavel

    Adding a local-only reproduction with a working/failing pair, since most linked reports involve Remote-SSH. This occurs in a plain local window with no remote of any kind, and with freshly reset caches.

    Environment

    • VS Code 1.128.0 (commit fc3def6), Electron 42.5.0
    • Fedora Linux 44 (KDE Plasma), Wayland (--ozone-platform=wayland)
    • Trigger extension: openai.chatgpt 26.707.71524 (Codex), whose webview loads several hundred JS/CSS assets on startup
    • No Remote-SSH / tunnel; local extension host; extension host was NOT recreated in the failing run

    Controlled variables

    Before the failing run, with VS Code fully exited, I moved aside Service Worker, Code Cache, and GPUCache from ~/.config/Code. The failure reproduced on the very next launch with fresh caches, so accumulated Service Worker state is not required.

    Failing launch

    About 1.4 s after the extension's webview started loading its assets, the renderer logged:

    [error] potential listener LEAK detected, popular: Error
        at a.create (workbench.desktop.main.js:431:18435)
        at kxe._event (workbench.desktop.main.js:433:2009)
        at new Ge (workbench.desktop.main.js:433:31379)
        at jle.doReadFileStream (workbench.desktop.main.js:5134:91433)
        at jle.readFileStream (workbench.desktop.main.js:5134:91369)
        at async MQo (workbench.desktop.main.js:5499:12707)
        at async W8e.loadResource (workbench.desktop.main.js:5499:27945)
    [error] potential listener LEAK detected, dominated: Error
        (same stack)
    

    The webview never finished executing its JS (the extension's own log shows its backend initialized, but the webview's React bootstrap never ran). The webview renderer process then sustained ~40% CPU and the GPU process ~42% indefinitely while displaying a static loading image.

    Working launch, same machine, 6 minutes later, nothing changed

    The SAME two listener-LEAK errors with the same doReadFileStream -> loadResource stack appeared, but the webview completed its bootstrap normally about 4 s after activation ("app routes mounted after 6262ms" in the extension log).

    Why this may be useful

    • The leak telemetry fires in both successful and failed loads of the same webview, so the bucket is a marker of the many-small-assets load burst, not of the failure itself. The user-visible failure is that some subset of resource loads apparently never completes (or never reaches the service worker consumer), leaving the webview's module graph unresolved with no error surfaced.
    • Reproduces locally on Linux/Wayland with fresh caches and no remote authority, so neither Remote-SSH latency nor accumulated Service Worker registrations are necessary conditions.
    • Consistent with the streamed webview resource path introduced in Use proper streams for loading webview resources #311844 intermittently dropping/stalling a transfer under a burst of hundreds of concurrent loadResource calls.

    codex-webview-hang-logs-minimal-20260714.zip

  7. FinalePrestissimo commented on Jul 15, 2026

    @FinalePrestissimo

    One additional observation, which I cannot currently reproduce reliably:

    On at least one occasion, after the Codex extension had initialized successfully and continued to work normally for some time, an additional Code Helper (Renderer) process appeared and sustained approximately 100%-200% CPU. I had not opened another VS Code window or launched another VS Code instance, and the visible Codex UI remained functional.

    I did not capture enough evidence at the time to map that renderer to a specific window, WebView, or Service Worker. I therefore cannot yet confirm that it was owned by Codex or that it followed the same failure path discussed above. Please treat this as a preliminary observation rather than a confirmed reproduction.

  8. added
    freeze-slow-crash-leak
    on Sep 28, 2026
  9. added a commit that references this issue on Sep 28, 2026
    2f1fe6e
  10. added
    unreleased
    on Sep 28, 2026
  11. added this to the 1.141.0 milestone on Sep 28, 2026
  12. added
    insiders-released
    and removed
    unreleased
    on Sep 29, 2026
  13. added a commit that references this issue on Oct 1, 2026
    1623144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugerror-telemetryfreeze-slow-crash-leakinsiders-releasedwebview

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions