Skip to content

[Bug]: Page.screenshot hangs when main resource does not finish #9757

Closed

Description

Context:

  • Playwright Version: > 1.14.1
  • Operating System: Linux
  • Node.js version: 16.12.0
  • Browser: Chromium
page.screenshot: Timeout 60000ms exceeded.
    at async (webpack://botagent/src/commands/screen.ts:11:52)
    at run (webpack://botagent/src/worker/pool.ts:24:28)
    at handler (webpack://botagent/src/worker/executor.ts:33:21)
    at async (webpack://botagent/src/router/router.ts:26:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
})();

All releases after 1.14.1 have this bug. I don't change anything in the software, but when updating to new release, the number of these errors becomes about 50%

Activity

  1. nexcode commented on Oct 25, 2021

    @nexcode
    Author

    On older releases, such errors happen, but very rarely.

  2. mxschmitt commented on Oct 25, 2021

    @mxschmitt
    Contributor

    Are you using Docker or launchServer/connect?

    Seems related to #9756. Only 1.16+ should be affected.

  3. nexcode commented on Oct 25, 2021

    @nexcode
    Author

    Don't use Docker. 1.15.x affected

    playwright.chromium.launchPersistentContext
    
  4. dgozman commented on Oct 27, 2021

    @dgozman
    Collaborator

    Oleg Trifonov (@nexcode) Do you have a repro script? Without a repro script we cannot reproduce the issue and fix it.

  5. nexcode commented on Oct 28, 2021

    @nexcode
    Author
  6. dgozman commented on Oct 29, 2021

    @dgozman
    Collaborator

    Oleg Trifonov (@nexcode) I am not able to reproduce with this snippet, unfortunately. Do you have any more details? We won't be able to help without reproducing the issue.

  7. sohaib17 commented on Nov 2, 2021

    @sohaib17

    In my case screenshot API is timing out most of the time on pages where request is aborted because of timeout.

    For cases like these I tried with CDP Page.captureScreenshot as well but CDP call never returns.

    Seems to be because of https://crbug.com/1121612

  8. nexcode commented on Nov 2, 2021

    @nexcode
    Author

    Yes, it can explain this behavior. But in theory, if goto is interrupted by timeout or throws an error, my code will not reach the screenshot, but will return an error or timeout from goto.

  9. nexcode commented on Nov 2, 2021

    @nexcode
    Author

    Does this bug occur precisely if there was an error loading the main document (html) or also when loading any resource by the browser?

  10. sohaib17 commented on Nov 2, 2021

    @sohaib17

    Might be that goto completes fine and then JS in page redirects and starts a new connection.

    This snippet reproduces the issue at my end (Python 3.8, CentOS 8):

    import asyncio
    from playwright.async_api import async_playwright, Error
    
    
    async def coroutine():
        async with async_playwright() as playwright:
            binary = playwright.chromium
            browser = await binary.launch(headless=True)
            page = await browser.new_page()
            try:
                await page.goto("https://blockchain.tinithral.com/LUNO-verify/")
            except Error:
                await page.evaluate('() => window.stop()')
            await page.screenshot(path='/tmp/test_shot.png', full_page=False)
            await browser.close()
    
    
    asyncio.run(coroutine())
    
  11. changed the title [-]page.screenshot: Timeout[/-] [+][Bug]: Page.screenshot hangs when main resource does not finish[/+] on Nov 2, 2021
  12. palewire commented on Mar 21, 2022

    @palewire

    Maybe this is just superstition talking here, but I downgraded to 1.14.1 as recommended by the OP and my bug here went away immediately.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    browser-chromiumBlocked on upstream chromium issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions