Skip to content

[Bug]: 1.52.0 hangs on "load tests" started or crush with out of memory #35706

@ziimakc

Description

@ziimakc

Version

1.52.0

Description

Playwright version 1.52.0 hangs when running tests or stops with out of memory when using --ui, while 1.51.1 works fine.

Logs without ui(hangs):

2025-04-23T12:13:13.600Z pw:test:task "apply rebaselines" started
2025-04-23T12:13:13.601Z pw:test:task "apply rebaselines" finished
2025-04-23T12:13:13.601Z pw:test:task "clear output" started
2025-04-23T12:13:13.601Z pw:test:task "clear output" finished
2025-04-23T12:13:13.601Z pw:test:task "plugin setup" started
2025-04-23T12:13:13.601Z pw:test:task "plugin setup" finished
2025-04-23T12:13:13.601Z pw:test:task "plugin setup" started
2025-04-23T12:13:13.601Z pw:webserver HTTP GET: http://localhost:3002/
2025-04-23T12:13:13.629Z pw:webserver HTTP Status: 200
2025-04-23T12:13:13.630Z pw:webserver WebServer is already available
2025-04-23T12:13:13.630Z pw:webserver Waiting for availability...
2025-04-23T12:13:13.630Z pw:webserver HTTP GET: http://localhost:3002/
2025-04-23T12:13:13.652Z pw:webserver HTTP Status: 200
2025-04-23T12:13:13.652Z pw:webserver WebServer available
2025-04-23T12:13:13.652Z pw:test:task "plugin setup" finished
2025-04-23T12:13:13.652Z pw:test:task "load tests" started

Logs that I somehow managed to copy before crush with --ui

2025-04-23T11:57:29.866Z pw:channel <EVENT {"guid":"","method":"__create__","params":{"type":"Playwright","initializer":{"chromium":{"guid":"browser-type@09b49a3e6fdee1d1b6b91216493aa6fe"},"firefox":{"guid":"browser-type@5c9f09c2ab5b071fee0fe20ce2b5e76e"},"webkit":{"guid":"browser-type@22ababf057e53151ad9bd0093c8a83ed"},"bidiChromium":{"guid":"browser-type@d6bccb7e0d8b0886b295b9115783d8a6"},"bidiFirefox":{"guid":"browser-type@d7b7f6786cc08f1de50145dd19526984"},"android":{"guid":"android@a6e55338a41dd14317cc897aa6bb8f8c"},"electron":{"guid":"electron@9c496dce35c3bb9a6e77acbb34071dcc"},"utils":{"guid":"localUtils"},"selectors":{"guid":"selectors@1039ec58f01782872305678583be8367"}},"guid":"Playwright"}}
node:buffer:837
    return this.utf8Slice(0, this.length);
                ^

Error: Cannot create a string longer than 0x1fffffe8 characters
    at Buffer.toString (node:buffer:837:17)
    at PipeTransport._dispatch (/home/xxx/node_modules/.pnpm/playwright-core@1.52.0/node_modules/playwright-core/lib/server/pipeTransport.js:67:57)
    at Socket.<anonymous> (/home/xxx/node_modules/.pnpm/playwright-core@1.52.0/node_modules/playwright-core/lib/server/pipeTransport.js:33:42)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Socket.Readable.push (node:internal/streams/readable:392:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) {
  code: 'ERR_STRING_TOO_LONG'
}

Screenshots(is it supposed to have so many slashes?):

Image
Image

Expected behavior

Tests should run fine.

Actual behavior

Tests hang or crush with out of memory when --ui used

Additional context

Let me know if I can debug it more precisely.

Environment

System:
    OS: Linux 6.11 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
    Memory: 5.85 GB / 14.87 GB
    Container: Yes
  Binaries:
    Node: 22.14.0 - /usr/bin/node
    npm: 10.9.2 - /usr/bin/npm
    pnpm: 10.8.0 - ~/snap/code/184/.local/share/pnpm/pnpm
  Languages:
    Bash: 5.2.21 - /usr/bin/bash

Activity

changed the title [-][Bug]: playwrite 1.52.0 hangs on "load tests" started or crush with out of memory[/-] [+][Bug]: 1.52.0 hangs on "load tests" started or crush with out of memory[/+] on Apr 23, 2025
agg23

agg23 commented on Apr 23, 2025

@agg23
Contributor

For the main issue, I suggest you look through https://playwright.dev/docs/debug to try to attach a debugger and step through what is happening. That will probably give you a good idea of what is hanging.

The --ui crash is due to having DEBUG flags set. This is something we should fix.

ziimakc

ziimakc commented on Apr 24, 2025

@ziimakc
Author

@agg23 debug is not helpful because it's stuck even before reaching a test :(

Logs while running:

process.env['DEBUG_FILE'] = "xxx.text"
process.env['DEBUG'] = "pw:*"

xxx.txt

agg23

agg23 commented on Apr 24, 2025

@agg23
Contributor

Ah, I see. Sorry, I missed that the task was named "load tests". Most likely this means that one of your test files is stalling, either in top level code (just sitting in a file) or within a describe. In order to load the tests, all of this code must be executed, so if something takes too long, we can hang. However, I am unsure how this could have regressed.

I recommend filtering the tests you attempt to execute to try to narrow down the test that is causing the issue. If you use the spec path filtering, npx playwright test some-file.spec.ts, it should hopefully bypass your issue so you can actually execute.

FranciscoKnebel

FranciscoKnebel commented on Apr 30, 2025

@FranciscoKnebel

Out of memory crashes has been a recurring problem for me for the last couple of months.
I noticed that if running npx playwright test --ui while having --ui-port=8080 --ui-host=0.0.0.0 flags set (https://playwright.dev/docs/test-ui-mode#docker--github-codespaces), to open the UI in an external browser, those crashes stopped happening.

Hopefully this helps.

agg23

agg23 commented on May 1, 2025

@agg23
Contributor

@FranciscoKnebel if you have more information and can come up with a repro, we would appreciate it if you filed a new issue. This issue isn't specifically an OOM issue.

ziimakc

ziimakc commented on May 1, 2025

@ziimakc
Author

Running one test or many doesn't change anything for me

agg23

agg23 commented on May 6, 2025

@agg23
Contributor

The OOM crash should now be solved with running UI Mode with DEBUG logging. However, that likely doesn't fix your root problem of tests freezing.

Ah, I see. Sorry, I missed that the task was named "load tests". Most likely this means that one of your test files is stalling, either in top level code (just sitting in a file) or within a describe. In order to load the tests, all of this code must be executed, so if something takes too long, we can hang. However, I am unsure how this could have regressed.

I recommend filtering the tests you attempt to execute to try to narrow down the test that is causing the issue. If you use the spec path filtering, npx playwright test some-file.spec.ts, it should hopefully bypass your issue so you can actually execute.

I still recommend these debugging steps.

ziimakc

ziimakc commented on May 6, 2025

@ziimakc
Author

I've tracked down issue to prisma client import import { PrismaClient, type Prisma } from "@libs/orm"; which was generated with the following config:

generator client {
  provider     = "prisma-client-js"
  output       = "../build" // `output` is required
  moduleFormat = "esm"
  runtime      = "node"
}

Steps to reproduce:

  1. Install prisma
  2. Generate client
  3. Import prisma client in test
agg23

agg23 commented on May 7, 2025

@agg23
Contributor

I am unable to reproduce. I performed the following steps:

mkdir prisma && cd prisma
npm init playwright@latest

npm i -D prisma
npm i @prisma/client

Created schema.prisma with the following contents:

datasource db {
  provider = "postgresql"
  url      = env("DB_URL")
}

generator client {
  provider     = "prisma-client-js"
  output       = "build" // `output` is required
  moduleFormat = "esm"
  runtime      = "node"
}

Generated Prisma data:

npx prisma generate

I edited tests/example.spec.ts to contain:

import { test, expect } from "@playwright/test";
import { PrismaClient } from "../build";

test("has title", async ({ page }) => {
  await page.goto("https://playwright.dev/");

  // Expect a title "to contain" a substring.
  await expect(page).toHaveTitle(/Playwright/);

  console.log(PrismaClient);
});

This executes and prints the PrismaClient object as expected.

ziimakc

ziimakc commented on May 7, 2025

@ziimakc
Author

@agg23 here is the reproduction repository, follow readme: https://github.com/ziimakc/playwright-error-reproduction

10 remaining items

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @agg23@dgozman@FranciscoKnebel@mxschmitt@ziimakc

    Issue actions

      [Bug]: 1.52.0 hangs on "load tests" started or crush with out of memory · Issue #35706 · microsoft/playwright