Skip to content

[BUG] browserContext.close takes too long when recording videos #4148

@Snikanes

Description

@Snikanes

Context:

  • Playwright Version: 1.5.0 and 1.5.1
  • Operating System: Linux
  • Node.js version: 12.18.3
  • Browser: Reproduced in Chromium, unsure about other browsers
  • Extra: Nothing in particular

Code Snippet

import { chromium } from "playwright";

(async () => {
  const videosPath = "./videocapture"; // Make sure this directory exists
  const browser = await chromium.launch({
    headless: true, // Headless or headful makes no difference
  });
  const context = await browser.newContext({
    videosPath, // Omitting videosPath makes browserContext.close take a few milliseconds
  });
  const page = await context.newPage();

  await page.goto("https://www.google.com"); // browserContext.close takes around 1 sec if only this page is loaded
  await page.goto("https://www.vg.no"); // browserContext.close takes around 4 secs if this and preceding pages are loaded
  await page.goto("https://www.dagbladet.no"); // browserContext.close takes around 5 secs if this and preceding pages are loaded
  await page.goto("https://www.aftenposten.no"); // browserContext.close takes around 9 secs if this and preceding pages are loaded
  await page.goto("https://www.dagsavisen.no"); // browserContext.close takes around 18-31 secs if this and preceding pages are loaded

  await page.close();
  await context.close();
  await browser.close();
})();

Screenshot from 2020-10-15 09-51-02

Describe the bug
When recording videos with the new stable video recording API, I find that closing browserContexts scales badly with video length. The snippet above provides a minimal reproducible example. I haven't tested very thoroughly, but enough that I am confident that there are some performance concerns here that should be addressed.

I would expect that saving a video should add much less overhead to browserContext.close than shown above, which https://github.com/qawolf/playwright-video manages to do pretty well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions