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]: Random TimeoutException errors when loading pages only when using --headless #14399

Closed
adrenaline681 opened this issue Aug 14, 2024 · 4 comments
Labels
G-chromedriver Requires fixes in ChromeDriver I-defect needs-triaging

Comments

@adrenaline681
Copy link

adrenaline681 commented Aug 14, 2024

What happened?

When using GUI mode I have no issues, I can get any page quickly using driver.get() without any error:

Loading Page Started: https://manos.ca/
Page Loaded in 0.73 seconds. Title: Mano's Restaurant & Lounge in Saskatoon | We Saved You A Spot
Loading Page Started: https://thecanadianbrewhouse.com/locations/saskatoon/
Page Loaded in 2.05 seconds. Title: Saskatoon’s Best Sports Bar | Locations | The Canadian Brewhouse

But when I switch to --headless or --headless=new some pages seem to freeze when loading, and this ends up triggering a TimeoutException. This doesn't happen on all pages, but only on some URLs that seem to have issues with the headless mode. In my example, I show 2 of these URLs that seem to be having issues.

Traceback (most recent call last):
  File "D:\Pycharm Projects\Tests\selenium-error-testing.py", line 15, in <module>
    driver.get(url)
  File "C:\Users\Desktop\AppData\Local\pypoetry\Cache\virtualenvs\tests-JpSX7oic-py3.12\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 363, in get
    self.execute(Command.GET, {"url": url})
  File "C:\Users\AlvDesktopro\AppData\Local\pypoetry\Cache\virtualenvs\tests-JpSX7oic-py3.12\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Desktop\AppData\Local\pypoetry\Cache\virtualenvs\tests-JpSX7oic-py3.12\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 299.926
  (Session info: chrome-headless-shell=127.0.6533.101)

In some rare cases, maybe 1 out of 10 times, one of the pages is able to load but takes much longer, over 20 seconds.

Loading Page Started: https://manos.ca/
Page Loaded in 23.59 seconds. Title: Mano's Restaurant & Lounge in Saskatoon | We Saved You A Spot

How can we reproduce the issue?

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

options = Options()
options.add_argument("--headless")
driver = webdriver.Chrome(options=options)

urls = ['https://manos.ca/', 'https://thecanadianbrewhouse.com/locations/saskatoon/']
for url in urls:
    start_time = time.time()
    print("Loading Page Started:", url)
    driver.get(url)
    print(f"Page Loaded in {round(time.time() - start_time, 2)} seconds. Title:", driver.title)

Relevant log output

Traceback (most recent call last):
  File "D:\Pycharm Projects\Tests\selenium-error-testing.py", line 15, in <module>
    driver.get(url)
  File "C:\Users\Desktop\AppData\Local\pypoetry\Cache\virtualenvs\tests-JpSX7oic-py3.12\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 363, in get
    self.execute(Command.GET, {"url": url})
  File "C:\Users\AlvDesktopro\AppData\Local\pypoetry\Cache\virtualenvs\tests-JpSX7oic-py3.12\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Desktop\AppData\Local\pypoetry\Cache\virtualenvs\tests-JpSX7oic-py3.12\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 299.926
  (Session info: chrome-headless-shell=127.0.6533.101)

Operating System

Windows 10

Selenium version

Python selenium = "4.23.1"

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

Version 127.0.6533.101 (Official Build) (64-bit)

Are you using Selenium Grid?

No and Yes, I've tried with both local selenium and remote using Grid and the issue happens in both.

Copy link

@adrenaline681, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@adrenaline681 adrenaline681 changed the title [🐛 Bug]: Random TimeoutException errors when loading pages while using the --headless option [🐛 Bug]: Random TimeoutException errors when loading pages only when using the --headless option Aug 14, 2024
@adrenaline681 adrenaline681 changed the title [🐛 Bug]: Random TimeoutException errors when loading pages only when using the --headless option [🐛 Bug]: Random TimeoutException errors when loading pages only when using --headless Aug 14, 2024
@pujagani
Copy link
Contributor

Thank you for sharing the details. There is a good chance this is a Chrome/ChromeDriver issue since Selenium just passes the headless options alone and routes the WebDriver APIs to the ChromeDriver.

@pujagani pujagani added the G-chromedriver Requires fixes in ChromeDriver label Aug 19, 2024
Copy link

Hi, @adrenaline681.
This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team.
Feel free to comment the issues that you raise back in this issue. Thank you.

Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
G-chromedriver Requires fixes in ChromeDriver I-defect needs-triaging
Projects
None yet
Development

No branches or pull requests

2 participants