Skip to content

Selenium Grid maxSession ignored #1694

@adamlacoste

Description

@adamlacoste

Expected Behavior -

When I start a grid hub and node with maxSession 1, then make multiple simultaneous requests to the hub with webdriver, no more than one of those requests should be fulfilled at a time.

Actual Behavior -

Making 5 simultaneous requests for a firefox session from the above setup results in 5 open firefox windows all processing at the same time.

Steps to reproduce -

I'm building a node.js application using the selenium-webdriver and selenium-server-standalone-jar NPM modules. The latter is just an include for selenium-server-standalone-2.52.0.jar. The application follows this process:

1) Start a selenium grid hub running locally

var jar = require("selenium-server-standalone-jar"),
    hub = new require("selenium-webdriver/remote").SeleniumServer(jar.path, {
        loopback: true,
        port:     4444,
        args:     [ "-role hub", "-hubConfig " + config_path ]
    });

That hub config file looks like this:

{
    "host": null,
    "port": 4444,
    "newSessionWaitTimeout": -1,
    "throwOnCapabilityNotPresent": true,
    "nodePolling": 5000,
    "cleanUpCycle": 5000,
    "timeout": 300000,
    "browserTimeout": 0,
    "maxSession": 1
}

2) Start a selenium grid node running locally

var hub = new require("selenium-webdriver/remote").SeleniumServer(jar.path, {
        loopback: true,
        port:     5555,
        args:     [ "-role node", "-nodeConfig " + config_path ]
    });

The node config looks like this:

{
    "capabilities": [
        {
            "browserName": "firefox",
            "maxInstances": 1,
            "seleniumProtocol": "WebDriver"
        }
    ],
    "configuration": {
        "maxSession": 1,
        "port": 5555,
        "host": "127.0.0.1",
        "register": true,
        "registerCycle": 5000,
        "hubPort": 4444,
        "hubHost": "127.0.0.1"
    }
}

So at this point I have a hub running with maxSession=1 and a node running with maxSession=1 and maxInstances=1 (for Firefox). This isn't how the application will function long term, I'm just trying to get Selenium Grid to demonstrate that it CAN limit sessions.

3) Start 5 child processes, each with its own webdriver using the hub server

I use child_process.exec to split off multiple child processes, each executing cucumber.js. Before each cucumber scenario, I create a new webdriver which uses the grid hub as its server, and after each scenario the webdriver is closed.

As mentioned above, I would expect only one of these child process webdrivers to be able to work at a time, but instead all do. This presents a scaling problem for me; 5 browser windows is fine, but 50 probably would not be. I need to be able to limit grid and the maxSession config parameter doesn't seem to be working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-gridEverything grid and server related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions