Skip to content

[BUG] Regression - chromium browser closes during test or debugging session on macos #12974

@str0zzapreti

Description

@str0zzapreti

Context:

  • Playwright Version: 1.20.0
  • Operating System: Macos 11.6.5
  • Python version: Python 3.10.2
  • Browser: Chromium

Code Snippet

The easiest way to replicate this issue is to just add a breakpoint in the following snippet after launching the browser, e.g. line 5, and then initialize the debugger and wait for it to reach the breakpoint. Then just wait and Chromium will suddenly close all on its own within a minute or two.

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()
    page.goto("http://playwright.dev/")
    print(page.title())
    browser.close()

Describe the bug

This issue began to occur after upgrading playwright to version 1.20.0 on my local machine. We have ~30 playwright tests that get parameterized to run in both Firefox and Chromium and I validated that everything was working by running the full test suite inside an Ubuntu Focal Docker container. So far, so good. The issue started to occur when I was helping a colleague debug an issue in headed mode and my chromium browser kept quitting in the middle of the debug session. The Playwright process continued running.

Then I tried running our full test suite locally in MacOS and after about 15-17 tests, all of the remaining chromium tests would instantly fail with an error indicating the page was already closed. This is extremely consistent and persisted through reboots and rebuilding my venv (I had been testing a pytest-parallel plugin and wanted to make sure it wasn't interfering) and only stops occurring when I downgrade playwright to 1.18.2 which is the last stable version we were using. I've included the traceback from the first chromium test that fails during each session. Seems to be some kind of memory error.

TLDR

  • Playwright 1.20.0 Chromium appears to crash after running for a minute or two on MacOS
  • Firefox does not exhibit this issue (I haven't tested webkit)
  • This issue does not occur in Linux (haven't tested windows)
  • This is a regression since 1.18.2 which was the last version I tested (we skipped over 1.19.x)

Traceback

self = <playwright._impl._connection.Channel object at 0x1089be530>
method = 'click', params = {'selector': 'a[href="/app/edit-recruiter-profile"]'}
return_as_dict = False
    async def inner_send(
        self, method: str, params: Optional[Dict], return_as_dict: bool
    ) -> Any:
        if params is None:
            params = {}
        callback = self._connection._send_message_to_server(self._guid, method, params)
        if self._connection._error:
            error = self._connection._error
            self._connection._error = None
            raise error
        done, _ = await asyncio.wait(
            {
                self._connection._transport.on_error_future,
                callback.future,
            },
            return_when=asyncio.FIRST_COMPLETED,
        )
        if not callback.future.done():
            callback.future.cancel()
>       result = next(iter(done)).result()
E       playwright._impl._api_types.Error: Browser closed.
E       ==================== Browser output: ====================
E       <launching> /Users/silasj/Library/Caches/ms-playwright/chromium-978106/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,AcceptCHFrame,AutoExpandDetailsElement --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --enable-use-zoom-for-dsf=false --no-sandbox --user-data-dir=/var/folders/kv/d09mrzfj49l9yp6hqzg58v840000gn/T/playwright_chromiumdev_profile-ibOEpD --remote-debugging-pipe --no-startup-window
E       <launched> pid=2236
E       [pid=2236][err] Received signal 6
E       [pid=2236][err]  [0x000118efda79]
E       [pid=2236][err]  [0x000118e59d13]
E       [pid=2236][err]  [0x000118efd9d1]
E       [pid=2236][err]  [0x7fff208d1d7d]
E       [pid=2236][err]  [0x7ffee14fb5d8]
E       [pid=2236][err]  [0x7fff207e1406]
E       [pid=2236][err]  [0x7fff206c1165]
E       [pid=2236][err]  [0x7fff206c42aa]
E       [pid=2236][err]  [0x000118a4b0fc]
E       [pid=2236][err]  [0x00011628f6af]
E       [pid=2236][err]  [0x000115395f67]
E       [pid=2236][err]  [0x0001166f4d1e]
E       [pid=2236][err]  [0x000118ee42e9]
E       [pid=2236][err]  [0x000118eb8a60]
E       [pid=2236][err]  [0x000118ecd979]
E       [pid=2236][err]  [0x000118ecd69c]
E       [pid=2236][err]  [0x000118ecde72]
E       [pid=2236][err]  [0x000118f0f323]
E       [pid=2236][err]  [0x000118f09cf2]
E       [pid=2236][err]  [0x000118f0ed5f]
E       [pid=2236][err]  [0x7fff2098437c]
E       [pid=2236][err]  [0x7fff209842e4]
E       [pid=2236][err]  [0x7fff20984064]
E       [pid=2236][err]  [0x7fff20982a8c]
E       [pid=2236][err]  [0x7fff2098204c]
E       [pid=2236][err]  [0x7fff28bcaa83]
E       [pid=2236][err]  [0x7fff28bca7e5]
E       [pid=2236][err]  [0x7fff28bca583]
E       [pid=2236][err]  [0x7fff2318ad72]
E       [pid=2236][err]  [0x7fff23189545]
E       [pid=2236][err]  [0x000118a12ab0]
E       [pid=2236][err]  [0x000118f09cf2]
E       [pid=2236][err]  [0x000118a129e9]
E       [pid=2236][err]  [0x7fff2317b869]
E       [pid=2236][err]  [0x000118f0fa2c]
E       [pid=2236][err]  [0x000118f0e892]
E       [pid=2236][err]  [0x000118ece0dd]
E       [pid=2236][err]  [0x000118e9843d]
E       [pid=2236][err]  [0x00011661ff7b]
E       [pid=2236][err]  [0x000116621612]
E       [pid=2236][err]  [0x00011661d8dc]
E       [pid=2236][err]  [0x00011899d4e8]
E       [pid=2236][err]  [0x00011899e53a]
E       [pid=2236][err]  [0x00011899e0cb]
E       [pid=2236][err]  [0x00011899c84c]
E       [pid=2236][err]  [0x00011899d0d0]
E       [pid=2236][err]  [0x0001152271be]
E       [pid=2236][err]  [0x00010e7018d1]
E       [pid=2236][err]  [0x7fff208a7f3d]
E       [pid=2236][err]  [0x000000000020]
E       [pid=2236][err] [end of stack trace]
E       [pid=2236][err] [0322/180717.089119:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffee14fe000, 0x2000): (os/kern) invalid address (1)
E       [pid=2236][err] [0322/180717.250919:WARNING:crash_report_exception_handler.cc(235)] UniversalExceptionRaise: (os/kern) failure (5)
E       =========================== logs ===========================
E       waiting for selector "a[href="/app/edit"]"
E         selector resolved to visible <a data-v-d7081870="" data-v-1b7f802e="" href="/app…>Complete task</a>
E       attempting click action
E         waiting for element to be visible, enabled and stable
E           element is not stable - waiting...
E       ============================================================
../venv/lib/python3.10/site-packages/playwright/_impl/_connection.py:63: Error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions