Skip to content

Bug: Memory Leak with watch mode --watch=true #4131

Description

@mxschmitt

Reproduction:

  1. git clone https://github.com/microsoft/playwright && cd playwright
  2. npm ci
  3. npx esbuild --log-level=verbose "packages/playwright-core/src/**/*.ts" --outdir=packages/playwright-core/lib --sourcemap=linked --watch=true --platform=node --format=cjs
  4. Go to packages/playwright-core/src/client/page.ts and modify the file header 20 times, between each time save the file and look at the memory consumption.

This can be used as well:

import fs from "fs"
for (let i = 0; i < 100; i++) {
  fs.appendFileSync("packages/playwright-core/src/client/page.ts", "\n")
  await new Promise((resolve) => setTimeout(resolve, 50))
}

and aborted after a few seconds.

Expected: It stays around 50-200 MB
Actual: It grows up to 10-40 GB

Version: 0.25.0 - also tested with 0.25.2

I was able to reproduce on macOS and Linux (Ubuntu amd64).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions