SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.97k stars 2.51k forks source link

[🐛 Bug]: Connection timeout #1431

Closed lcouveignes closed 3 years ago

lcouveignes commented 3 years ago

What happened?

There are times when I get a connection timeout when I want to connect to my docker

Command used to start Selenium Grid with Docker

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "containerGroups_amc_agregateur_browser_name": {
            "defaultValue": "amc-agregateur-browser",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.ContainerInstance/containerGroups",
            "apiVersion": "2021-07-01",
            "name": "[parameters('containerGroups_amc_agregateur_browser_name')]",
            "location": "westeurope",
            "properties": {
                "sku": "Standard",
                "containers": [
                    {
                        "name": "[parameters('containerGroups_amc_agregateur_browser_name')]",
                        "properties": {
                            "image": "selenium/standalone-chrome:4.0.0-rc-1-prerelease-20210823",
                            "ports": [
                                {
                                    "protocol": "TCP",
                                    "port": ****
                                },
                                {
                                    "protocol": "TCP",
                                    "port": ****
                                }
                            ],
                            "environmentVariables": [
                                {
                                    "name": "START_XVFB",
                                    "value": "false"
                                },
                                {
                                    "name": "SE_NODE_OVERRIDE_MAX_SESSIONS",
                                    "value": "true"
                                },
                                {
                                    "name": "SE_NODE_MAX_SESSIONS",
                                    "value": "50"
                                }
                            ],
                            "resources": {
                                "requests": {
                                    "memoryInGB": 1.5,
                                    "cpu": 1
                                }
                            },
                            "volumeMounts": [
                                {
                                    "name": "browservolume1",
                                    "mountPath": "/tmp/downloads",
                                    "readOnly": false
                                }
                            ]
                        }
                    }
                ],
                "initContainers": [],
                "restartPolicy": "OnFailure",
                "ipAddress": {
                    "ports": [
                        {
                            "protocol": "TCP",
                            "port": ****
                        },
                        {
                            "protocol": "TCP",
                            "port": ****
                        }
                    ],
                    "ip": "**.**.***.***",
                    "type": "Public"

                },
                "osType": "Linux",
                "volumes": [
                    {
                        "name": "browservolume1",
                        "azureFile": {
                            "shareName": "browser-chrome-download",
                            "readOnly": false,
                            "storageAccountName": "amcsastorage"
                        }
                    }
                ]
            }
        }
    ]
}

Relevant log output

The HTTP request to the remote WebDriver server for URL ***** timed out after 60 seconds.

Operating System

Docker azure

Docker Selenium version (tag)

4.0.0-rc-1 (revision ea41b757bd)

SavitaMaurya commented 3 years ago

Experiencing similar issue

diemol commented 3 years ago

@lcouveignes what code script can we use to reproduce the issue?

lcouveignes commented 3 years ago

In C# WebDriver = new OpenQA.Selenium.Remote.RemoteWebDriver(new Uri(SeleniumBrowserUrl), optionsChrome);

diemol commented 3 years ago

Please provide a GitHub repo or a complete script, I cannot see which version of C#, what url is being used, etc.

This issue will likely be ignored if a complete reproduction scenario is not provided, this is simply to avoid ambiguities.

lcouveignes commented 3 years ago

I don't understand your need. I mounted the image on a docker on Azure and I'm calling an azure function with the code I sent you to connect to the docker image.

diemol commented 3 years ago

I am still not able to reproduce, what version of the C# bindings are you using? The latest is 4.0.1. Also, please try the most recent image.

If you are still facing the issue, please provide a complete code example I can copy & paste to execute on my machine to reproduce the issue. Please note that I do not have an Azure account, so it would be ideal if you try first with the Docker images locally.

namilkimfree commented 3 years ago

@diemol

I am using version 4.0.1 version

When more than two hubs are connected, more than 50% timeout exception occurs.

Code


 var driverOptions = new ChromeOptions { AcceptInsecureCertificates = true };

            driverOptions.AddArgument("--start-maximized");
            driverOptions.AddArguments("disable-infobars");
            driverOptions.AddArgument("--window-size=1920,1080");
            driverOptions.AddArgument("--disable-background-timer-throttling");
            driverOptions.AddArgument("--disable-backgrounding-occluded-windows");
            driverOptions.AddArgument("--disable-breakpad");
            driverOptions.AddArgument("--disable-component-extensions-with-background-pages");
            driverOptions.AddArgument("--disable-dev-shm-usage");
            driverOptions.AddArgument("--disable-extensions");
            driverOptions.AddArgument("--disable-features=TranslateUI,BlinkGenPropertyTrees");
            driverOptions.AddArgument("--disable-ipc-flooding-protection");
            driverOptions.AddArgument("--disable-renderer-backgrounding");
            driverOptions.AddArgument("--enable-features=NetworkService,NetworkServiceInProcess");
            driverOptions.AddArgument("--force-color-profile=srgb");
            driverOptions.AddArgument("--hide-scrollbars");
            driverOptions.AddArgument("--metrics-recording-only");
            driverOptions.AddArgument("--mute-audio");
            driverOptions.AddArgument("--headless");
            driverOptions.AddArgument("--no-sandbox");
            driverOptions.AddArgument("disable-gpu");
            driverOptions.AddExcludedArgument("enable-automation");
            driverOptions.AddAdditionalOption("useAutomationExtension", false);

            driverOptions.PageLoadStrategy = PageLoadStrategy.Normal;

            var driver = new RemoteWebDriver(new Uri("http://myVMIp:4444/"), driverOptions.ToCapabilities(),
                TimeSpan.FromSeconds(120));
            driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(60);
            ((RemoteWebDriver)driver).FileDetector = new LocalFileDetector();
            driver.Url = _globalConfig.BaseUrl;

Excetion


 Message: 
    timeout: Timed out receiving message from renderer: 59.953
      (Session info: headless chrome=94.0.4606.81)

  Stack Trace: 
    OpenQA.Selenium.WebDriverTimeoutException: timeout: Timed out receiving message from renderer: 59.953
  (Session info: headless chrome=94.0.4606.81)
    WebDriver.UnpackAndThrowOnError(Response errorResponse)
    WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
    WebDriver.set_Url(String value)
    BrowserSeleniumDriverFactory.GetChromeDriver() line 117
    BrowserSeleniumDriverFactory.GetForBrowser() line 32
    SeleniumService.GetWebDriver() line 112
    Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
    --- End of stack trace from previous location ---
    Lazy`1.CreateValue()
    <9 more frames...>
    RunnerTestExecutionEngine.OnStepEnd()
    TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) line 570
    TestExecutionEngine.Step(StepDefinitionKeyword stepDefinitionKeyword, String keyword, String text, String multilineTextArg, Table tableArg) line 686
    RunnerTestExecutionEngine.Step(StepDefinitionKeyword stepDefinitionKeyword, String keyword, String text, String multilineTextArg, Table tableArg)
    TestRunner.Given(String text, String multilineTextArg, Table tableArg, String keyword) line 79
    WriteAllFailFeature.FeatureBackground() line 6
    WriteAllFailFeature.EmailLoginUserWriteInFullArticle() line 5
    StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext)
    StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext)
    TestNodeTask.Execute()
diemol commented 3 years ago

Can you share how you are starting the docker images and the docker container logs as well?

namilkimfree commented 3 years ago

4.0.0-20211102 Changing the version doesn't cause any problems.

4.0.0-rc-3-20211010 There was a problem with that version.

diemol commented 3 years ago

I'll close this as it seems it got fixed with the most recent versions and also we never got a way to reproduce the issue.

github-actions[bot] commented 2 years ago

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