Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] #20347

Closed
doliere opened this issue Jan 24, 2023 · 4 comments · Fixed by #20379
Closed

[BUG] #20347

doliere opened this issue Jan 24, 2023 · 4 comments · Fixed by #20379
Assignees
Labels

Comments

@doliere
Copy link

doliere commented Jan 24, 2023

Context:

  • Playwright Version: 1.29.2
  • Operating System: Mac
  • Node.js version: v18.11.0
  • Browser: Chromium
  • Extra:

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

const playwright = require('playwright');

(async () => {
    let browser = await playwright.chromium.launch({
        headless: false
    })
    let page = await browser.newPage();
    await page.goto('https://easyimages.net');
}) ();

Describe the bug

The browser keeps crashing with the following error

/Users/johndoe/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js:153
    return '[' + String(result) + ']';
                 ^

RangeError: Invalid string length
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at String (<anonymous>)
    at renderPreview (/Users/johndoe/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js:153:18)
    at CRExecutionContext.createHandle (/Users/johndoe/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js:108:80)
    at FrameExecutionContext.createHandle (/Users/johndoe/node_modules/playwright-core/lib/server/javascript.js:67:27)
    at FrameExecutionContext.createHandle (/Users/johndoe/node_modules/playwright-core/lib/server/dom.js:84:18)
    at /Users/johndoe/node_modules/playwright-core/lib/server/chromium/crPage.js:692:50
    at Array.map (<anonymous>)
    at FrameSession._onConsoleAPI (/Users/johndoe/node_modules/playwright-core/lib/server/chromium/crPage.js:692:31)

I have tried the same code with Puppeteer and the issue was not there. The problem seems to be related to iframes that are loaded within the particular site.

@pavelfeldman
Copy link
Member

I can repro, this looks like an OOM while building the console object previews. Not sure how Puppeteer is relevant, but this looks like a real Playwright bug.

aslushnikov added a commit to aslushnikov/playwright that referenced this issue Jan 25, 2023
Right now arrays preview yields all array elements. In case
of a sparse array with a single element on index 10000000,
this results in a large string that OOM Node.js.

This patch changes pretty-printing. For example:

```ts
// Given this array
const a = [];
a[10] = 1;
// Before this patch, pretty printing will yield:
"[,,,,,,,,1]"
// With this patch, pretty printing yields:
"[<9 empty items>,1]"
```

The new array pretty-printing is equal to what Node.js CLI
does to render sparse arrays.

Fixes microsoft#20347
aslushnikov added a commit that referenced this issue Jan 27, 2023
Right now arrays preview yields all array elements. In case
of a sparse array with a single element on index 10000000,
this results in a large string that OOM Node.js.

This patch changes pretty-printing. For example:

```ts
// Given this array
const a = [];
a[10] = 1;
// Before this patch, pretty printing will yield:
"[,,,,,,,,1]"
// With this patch, pretty printing yields:
"[empty x 9, 1]"
```

The new array pretty-printing is equal to what Chrome DevTools
do to render sparse arrays.

Fixes #20347
@doliere
Copy link
Author

doliere commented Jan 28, 2023

I upgraded to Playwright 1.30.0, but I can still reproduce the bug, on Mac, Linux

@aslushnikov
Copy link
Collaborator

@doliere the fix didn't make it to 1.30 - it'll be released in 1.31. You can try it out on Playwright canary:

npm i @playwright/test@next

@doliere
Copy link
Author

doliere commented Jan 29, 2023

that works, thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants