{"action":"created","issue":{"url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/issues/28","repository_url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service","labels_url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/issues/28/comments","events_url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/issues/28/events","html_url":"https://github.com/webdriverio/wdio-selenium-standalone-service/issues/28","id":252086564,"node_id":"MDU6SXNzdWUyNTIwODY1NjQ=","number":28,"title":"Session is not cleaning up all chromedriver processes","user":{"login":"Gary-Osteen-Q2","id":30158849,"node_id":"MDQ6VXNlcjMwMTU4ODQ5","avatar_url":"https://avatars0.githubusercontent.com/u/30158849?v=4","gravatar_id":"","url":"https://api.github.com/users/Gary-Osteen-Q2","html_url":"https://github.com/Gary-Osteen-Q2","followers_url":"https://api.github.com/users/Gary-Osteen-Q2/followers","following_url":"https://api.github.com/users/Gary-Osteen-Q2/following{/other_user}","gists_url":"https://api.github.com/users/Gary-Osteen-Q2/gists{/gist_id}","starred_url":"https://api.github.com/users/Gary-Osteen-Q2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gary-Osteen-Q2/subscriptions","organizations_url":"https://api.github.com/users/Gary-Osteen-Q2/orgs","repos_url":"https://api.github.com/users/Gary-Osteen-Q2/repos","events_url":"https://api.github.com/users/Gary-Osteen-Q2/events{/privacy}","received_events_url":"https://api.github.com/users/Gary-Osteen-Q2/received_events","type":"User","site_admin":false},"labels":[{"id":299497997,"node_id":"MDU6TGFiZWwyOTk0OTc5OTc=","url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":38,"created_at":"2017-08-22T20:55:15Z","updated_at":"2018-07-31T12:03:19Z","closed_at":null,"author_association":"NONE","body":"For versions 0.0.8 and 0.0.9, the test run does not shut down all 2.31-x64-chromedriver processes when finished. This does not happen when using firefox/geckodriver. When running more than one spec, multiple 2.31-x64-chromedriver processes get started but one will always remain per test run. I have tested this with 1 and 2 specs in the wdio conf.\r\n\r\n\r\n**Current workaround that works for me:**\r\n\r\nAdd this to your wdio.config.js file.\r\n```javascript\r\nafterSession: async function(){\r\n    // workaround to make sure the chromedriver shuts down\r\n    await browser.end().pause(1000);\r\n},\r\nafter: async function(){\r\n    // workaround to make sure the chromedriver shuts down\r\n    await browser.pause(1000);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/issues/comments/409195880","html_url":"https://github.com/webdriverio/wdio-selenium-standalone-service/issues/28#issuecomment-409195880","issue_url":"https://api.github.com/repos/webdriverio/wdio-selenium-standalone-service/issues/28","id":409195880,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTE5NTg4MA==","user":{"login":"cm-app","id":41048966,"node_id":"MDQ6VXNlcjQxMDQ4OTY2","avatar_url":"https://avatars0.githubusercontent.com/u/41048966?v=4","gravatar_id":"","url":"https://api.github.com/users/cm-app","html_url":"https://github.com/cm-app","followers_url":"https://api.github.com/users/cm-app/followers","following_url":"https://api.github.com/users/cm-app/following{/other_user}","gists_url":"https://api.github.com/users/cm-app/gists{/gist_id}","starred_url":"https://api.github.com/users/cm-app/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cm-app/subscriptions","organizations_url":"https://api.github.com/users/cm-app/orgs","repos_url":"https://api.github.com/users/cm-app/repos","events_url":"https://api.github.com/users/cm-app/events{/privacy}","received_events_url":"https://api.github.com/users/cm-app/received_events","type":"User","site_admin":false},"created_at":"2018-07-31T12:03:19Z","updated_at":"2018-07-31T12:03:19Z","author_association":"NONE","body":"If you start the wdio runner programmatically using the wdio launcher (const wdio = new Launcher(\"wdio.conf.js\", {port: 9515});) and spawn the selenium and chromedriver processes yourself, and let the tests finsish, the processes disappear on their own. That means under normal circumstances Selenium handles the clean up itself without the need to kill processes.\r\n\r\nThe problem seems to be rooted in the test runner: node_modules/webdriverio/build/lib/runner.js: process.exit() //case: 50 | line ~280\r\n\r\nIt probably exits the session too early. I assume the session process is the same that spawned the selenium server via the selenium service module? If so, when it exits it also kills the selenium (java) child process which, at this point, has not shutdown Chromedriver yet. \r\n\r\nBut that is all a bit iffy though. Because the following workaround should actualy work: Spawn the Java/Selenium process in the selenium-standalone module with the \"detached\" option true (https://nodejs.org/api/child_process.html#child_process_options_detached). This would decouple the Java process from Node so that Node could exit, leaving the cleanup to Selenium. While this does get rid of the Chromedriver, now a Java process stays open. Does Selenium shut down the driver but not itself then? But it does when running it programmatically!\r\n\r\nThe only working solution is if you put the process.exit() in runner.js in a (long enough, +100ms) setTimeout. But that is kind of hacky."}}
{"actor":{"display_login":"cm-app"}}