theintern / digdug

A JavaScript library for launching WebDriver service tunnels.
https://theintern.github.io/digdug/
Other
44 stars 28 forks source link

chromedriver.exe stays running after tunnel stops #58

Closed kanagan123 closed 6 years ago

kanagan123 commented 6 years ago

I've noticed after my functional tests finish, the browser closes, but chromedriver.exe stays running, leading to multiple instances of chromedriver piling up. The tunnel emits the stopped status and in my console i see "Stopped", so it doesn't seem to be an issue of the tunnel not stopping. I am using selenium tunnel with the following config:

{
    "functionalSuites": "tests/functional/*.js",
    "environments": [
        {
            "browserName": "chrome"
        }
    ],
    "reporters": [{"name": "junit", "filename": "report.xml"}, "runner"],
    "tunnelOptions": {
        "version": "3.8.1",
        "drivers": [
            {
                "name": "chrome"
            }
        ]
    }
}

I was able to get chromedriver.exe to exit by changing

childProcess.kill('SIGINT')

in ./node_modules/@theintern/digdug/Tunnel.js to

setTimeout(function() {
    childProcess.kill('SIGINT');
}, 100);

So, by waiting for 1/10 of a second before killing java.exe, chromedriver.exe actually gets killed. I'm not sure if this is a problem with your codebase or my configuration, which is very minimal. Any help is greatly appreciated.

Intern Version: 4.1.5 Selenium-Server-Standalone-Jar Version: 3.8.1 Chromedriver Version: 2.35 OS: Windows 7 Browser: Chrome Stable (v63)

Both chromedriver.exe and selenium-server-standalone-3.8.1.jar are in ./node_modules/@theintern/digdug/selenium-standalone

jason0x43 commented 6 years ago

It's not just you -- I'd noticed that on occasion, too, but hadn't looked into it much yet. We're probably killing Selenium before it's had a chance to properly shutdown chromedriver, although I would have thought chromedriver would die when Selenium was killed. In any case, we can probably inspect Selenium's output to determine when chromedriver has been shut down before sending the SIGINT.

jason0x43 commented 6 years ago

This should be fixed in c2c0347, which is included in release 2.1.0. If the issue comes up again, we can reopen this.