Skip to content

Exception:Connection closed while reading from the driver #2911

@chanyixialex

Description

@chanyixialex

Environment:

os: SUSE Linux
python: 3.11
chromium: 114.0.5735.196

Try running the following code in Linux system:

async def batch_screenshot(self, data_views, screenshot_save_dir):

    async with async_playwright() as p:

        browser = await p.chromium.launch(executable_path=chromium_executable_path, headless=True, args=[
            '--disable-gpu',
            '--no-sandbox',
            '--disable-dev-shm-usage',
        ])

        tasks = [self.screenshot_task(browser, data_view.chart_name, data_view.chart_metadata, data_view.view_port_size, screenshot_save_dir) for
                 data_view in data_views]
        results = await asyncio.gather(*tasks)

        paths = [path for path in results if path is not None]
        await browser.close()

        return paths

Report an error:

Traceback (most recent call last):
File "/opt/mateinfo/python-app/src/tools/screenshot/screenshot.py", line 34, in screenshot_tool
screenshot_save_full_path_list = await screenshot_tool.batch_screenshot(data_views, screenshot_save_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/mateinfo/python-app/src/tools/screenshot/screenshot_tool.py", line 72, in batch_screenshot
async with async_playwright() as p:
File "/opt/mateinfo/profile/.local/lib/python3.11/site-packages/playwright/async_api/_context_manager.py", line 46, in aenter
playwright = AsyncPlaywright(next(iter(done)).result())
^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: Connection closed while reading from the driver
[2025-07-02 09:01:29,762]-[ERROR]-[screenshot.screenshot_api] Connection closed while reading from the driver
Traceback (most recent call last):
File "/opt/mateinfo/python-app/src/tools/screenshot/screenshot_api.py", line 44, in generate_chart
screenshot_save_full_path_list = await screenshot_tool(screenshotRequest.data_views, chart_save_work_dir, tenant_id.get(), username.get())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/mateinfo/python-app/src/tools/screenshot/screenshot.py", line 41, in screenshot_tool
raise e
File "/opt/mateinfo/python-app/src/tools/screenshot/screenshot.py", line 34, in screenshot_tool
screenshot_save_full_path_list = await screenshot_tool.batch_screenshot(data_views, screenshot_save_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/mateinfo/python-app/src/tools/screenshot/screenshot_tool.py", line 72, in batch_screenshot
async with async_playwright() as p:
File "/opt/mateinfo/profile/.local/lib/python3.11/site-packages/playwright/async_api/_context_manager.py", line 46, in aenter
playwright = AsyncPlaywright(next(iter(done)).result())
^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: Connection closed while reading from the driver

By the way

The error does not occur in other Linux systems.

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