-
Notifications
You must be signed in to change notification settings - Fork 14
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
Error: socket hang up OR Error: connect ECONNREFUSED 127.0.0.1:42395 - when 'docker' and 'devtools' services are used together. #78
Comments
@Pratikhanagodimath I don't believe Chrome runs debugger by default. You may need to turn it on through flags (Ex. |
@stsvilik thanks!. I have tried it but seem to be getting "Error: socket hang up". Below is my config and error message. config
ERROR 2020-03-18T03:04:51.237Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker" |
@Pratikhanagodimath just for the sake of following order of elimination - a) did you try running tests w/o devtools and b) have tried running docker image |
@stsvilik
b)
Dockerfile
Output when tests ran within the container
|
@Pratikhanagodimath for My suspicion is that |
@stsvilik Sorry for my delayed response. I tried what you asked and got back a response. Detailed below:
So it does work. Strange that it did not work as per wdio config mentioned above. I still get "socket hung up" error. |
@Pratikhanagodimath Any luck? We had some troubles configuring docker and devtools services together, because there were a lot of hidden details we were not figuring out at first. For our setup, we want to run the wdio process in the host machine, pointing to a docker instance with Chrome. Ideally, the browser can also access our development webpack instance (host machine) for better DX. Recapping, we have our host machine running 2 processes, webpack in dev mode (optional) and wdio tests, and the docker instance running Google Chrome, with exposed devtools to the network. From what we understood, you need to take into account:
I think the minimum configs we need for this setup are the following: module.exports = {
runner: 'local',
sync: true,
hostname: '127.0.0.1',
port: 4444,
protocol: 'http',
path: '/wd/hub',
capabilities: [
{
maxInstances: 1,
browserName: 'chrome',
'goog:chromeOptions': {
args: [
'--no-sandbox',
'--disable-gpu',
'--incognito',
'--remote-debugging-address=0.0.0.0', // expose to calls from the host machine!
'--remote-debugging-port=9222',
'--headless', // must be headless to use the the docker service with devtools support!
'--window-size=1366,768'
]
}
}
],
baseUrl: 'http://custom-local-domain.com:8080', // running webpack on the host machine
services: [
[ 'devtools', { debuggerAddress: `localhost:9222` } ],
'docker'
],
dockerLogs: './',
dockerOptions: {
image: 'selenium/standalone-chrome-debug:3.141.59-20200826', // contains Chrome 85.0.4183.83
healthCheck: {
url: 'http://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 2000
},
options: {
// VNC and Selenium hub are already exposed in docker image, so we only need to add the
// port for devtools
expose: [ 9222 ],
p: [
'4444:4444',
'5900:5900',
'0.0.0.0:9222:9222' // 0.0.0.0 to expose devtools debugger from any location
],
addHost: [
// optional -> expose webpack from host machine (192.168.1.10)
`custom-local-domain.com:192.168.1.10`,
],
shmSize: '2g'
}
},
onDockerReady: () => {
console.log('Ready to connect VNC client on localhost:5900');
}
} The VNC configuration is included too, because some of our tests can run with open browser, as they don't require devtools access. |
I am attempting to use docker and devtools service together to evaluate performance of a page. Running locally. I am running into issues when I include ‘devtools’ as a service along with docker service, without ‘devtools’ the test just runs fine. Below is the error I see. What am I missing?. Seems like same issue mentioned here by prathameshnyt -> #3744 (comment)
Error without the mention of chrome debuggerAddress
2020-03-16T22:29:25.397Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
2020-03-16T22:29:25.405Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
2020-03-16T22:29:25.702Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-03-16T22:29:25.703Z DEBUG wdio-docker-service: Docker command: docker run --cidfile /Users/phanagodimath/Desktop/Projects/Martech-Performance/selenium_standalone_chrome.cid --rm -p 4444:4444 --shm-size 2g selenium/standalone-chrome
2020-03-16T22:29:25.710Z WARN wdio-docker-service: Connecting dockerEventsListener: 6138
2020-03-16T22:29:25.712Z INFO wdio-docker-service: Shutting down running container
2020-03-16T22:29:26.074Z INFO wdio-docker-service: Cleaning up CID files
2020-03-16T22:29:26.127Z INFO wdio-docker-service: Launching docker image 'selenium/standalone-chrome'
2020-03-16T22:29:26.471Z INFO wdio-docker-service: Container started: {
"args": "",
"image": "selenium/standalone-chrome",
"timeStamp": "2020-03-16T22:29:26.480Z",
"type": "container.start",
"status": "start",
"detail": {
"id": "3c9d234b53b5e9ff0997826cff84b8dd5b378595ea1da0363f205f56dbc94a0d",
"scope": "local",
"actor": {
"ID": "3c9d234b53b5e9ff0997826cff84b8dd5b378595ea1da0363f205f56dbc94a0d",
"Attributes": {
"authors": "SeleniumHQ",
"image": "selenium/standalone-chrome",
"name": "musing_elbakyan"
}
}
}
}
2020-03-16T22:29:26.587Z DEBUG wdio-docker-service: 2020-03-16 22:29:26,597 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2020-03-16T22:29:26.588Z DEBUG wdio-docker-service: 2020-03-16 22:29:26,598 INFO supervisord started with pid 7
2020-03-16T22:29:27.592Z DEBUG wdio-docker-service: 2020-03-16 22:29:27,603 INFO spawned: 'xvfb' with pid 10
2020-03-16T22:29:27.594Z DEBUG wdio-docker-service: 2020-03-16 22:29:27,605 INFO spawned: 'selenium-standalone' with pid 11
2020-03-16T22:29:28.066Z DEBUG wdio-docker-service: 22:29:28.075 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2020-03-16 22:29:28,078 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16 22:29:28,078 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16T22:29:28.222Z DEBUG wdio-docker-service: 22:29:28.234 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-03-16T22:29:28.322Z DEBUG wdio-docker-service: 2020-03-16 22:29:28.327:INFO::main: Logging initialized @710ms to org.seleniumhq.jetty9.util.log.StdErrLog
2020-03-16T22:29:28.735Z DEBUG wdio-docker-service: 22:29:28.745 INFO [WebDriverServlet.] - Initialising WebDriverServlet
2020-03-16T22:29:28.896Z DEBUG wdio-docker-service: 22:29:28.908 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
2020-03-16T22:29:29.249Z INFO wdio-docker-service: Docker container is ready
2020-03-16T22:29:29.251Z INFO @wdio/local-runner: Start worker 0-0 with arg: config/wdio.conf.docker.js
[0-0] 2020-03-16T22:29:29.475Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /test/specs/basic_docker.js
[0-0] 2020-03-16T22:29:29.553Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
[0-0] 2020-03-16T22:29:29.558Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
[0-0] 2020-03-16T22:29:29.840Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-03-16T22:29:29.841Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-03-16T22:29:29.843Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2020-03-16T22:29:29.843Z INFO webdriver: DATA {
capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' }
}
2020-03-16T22:29:29.989Z DEBUG wdio-docker-service: 22:29:30.002 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome"
}
2020-03-16T22:29:29.992Z DEBUG wdio-docker-service: 22:29:30.005 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
2020-03-16T22:29:30.032Z DEBUG wdio-docker-service: Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 7411
2020-03-16T22:29:30.037Z DEBUG wdio-docker-service: Only lo[c1a5l8 4c3o9n7n7e7c0t.i0o4n5s] [aSrEeV EaRlEl]o:w ebdi.n
Pdl(e)a sfea iplreodt:e cCta npnoortts used by C harsosmiegDnr irveerq uaensdt erde laadtderde stse s(t9 9f)r
2020-03-16T22:29:30.038Z DEBUG wdio-docker-service: ameworks to prevent access by malicious code.
2020-03-16T22:29:30.855Z DEBUG wdio-docker-service: 22:29:30.870 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
2020-03-16T22:29:30.919Z DEBUG wdio-docker-service: 22:29:30.934 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 29c930f81189207ce9af3ddeadcf1107 (org.openqa.selenium.chrome.ChromeDriverService)
[0-0] (node:6155) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:34783
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1126:14)
[0-0] (node:6155) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6155) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^Z
[5]+ Stopped npm run test:docker
Error running with chrome debuggerAddress
2020-03-16T22:05:09.898Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
2020-03-16T22:05:09.903Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
2020-03-16T22:05:10.176Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-03-16T22:05:10.177Z DEBUG wdio-docker-service: Docker command: docker run --cidfile /Users/phanagodimath/Desktop/Projects/Martech-Performance/selenium_standalone_chrome.cid --rm -p 4444:4444 -p 9222:9222 --shm-size 2g --hostname selenium selenium/standalone-chrome
2020-03-16T22:05:10.182Z WARN wdio-docker-service: Connecting dockerEventsListener: 5857
2020-03-16T22:05:10.185Z INFO wdio-docker-service: Shutting down running container
2020-03-16T22:05:10.529Z INFO wdio-docker-service: Cleaning up CID files
2020-03-16T22:05:10.581Z INFO wdio-docker-service: Launching docker image 'selenium/standalone-chrome'
2020-03-16T22:05:10.979Z INFO wdio-docker-service: Container started: {
"args": "",
"image": "selenium/standalone-chrome",
"timeStamp": "2020-03-16T22:05:11.004Z",
"type": "container.start",
"status": "start",
"detail": {
"id": "ec657e32cce91f66e021b65a52364b800b5ff2fbccbaad281b97cf9be7924ca3",
"scope": "local",
"actor": {
"ID": "ec657e32cce91f66e021b65a52364b800b5ff2fbccbaad281b97cf9be7924ca3",
"Attributes": {
"authors": "SeleniumHQ",
"image": "selenium/standalone-chrome",
"name": "focused_dirac"
}
}
}
}
2020-03-16T22:05:11.084Z DEBUG wdio-docker-service: 2020-03-16 22:05:11,109 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2020-03-16T22:05:11.085Z DEBUG wdio-docker-service: 2020-03-16 22:05:11,110 INFO supervisord started with pid 7
2020-03-16T22:05:12.095Z DEBUG wdio-docker-service: 2020-03-16 22:05:12,118 INFO spawned: 'xvfb' with pid 10
2020-03-16 22:05:12,120 INFO spawned: 'selenium-standalone' with pid 11
2020-03-16T22:05:12.548Z DEBUG wdio-docker-service: 22:05:12.572 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2020-03-16T22:05:12.548Z DEBUG wdio-docker-service: 2020-03-16 22:05:12,575 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16 22:05:12,575 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16T22:05:12.703Z DEBUG wdio-docker-service: 22:05:12.730 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-03-16T22:05:12.805Z DEBUG wdio-docker-service: 2020-03-16 22:05:12.826:INFO::main: Logging initialized @694ms to org.seleniumhq.jetty9.util.log.StdErrLog
2020-03-16T22:05:13.207Z DEBUG wdio-docker-service: 22:05:13.232 INFO [WebDriverServlet.] - Initialising WebDriverServlet
2020-03-16T22:05:13.362Z DEBUG wdio-docker-service: 22:05:13.389 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
2020-03-16T22:05:13.706Z INFO wdio-docker-service: Docker container is ready
2020-03-16T22:05:13.708Z INFO @wdio/local-runner: Start worker 0-0 with arg: config/wdio.conf.docker.js
[0-0] 2020-03-16T22:05:13.937Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /test/specs/basic_docker.js
[0-0] 2020-03-16T22:05:14.024Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
[0-0] 2020-03-16T22:05:14.030Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
[0-0] 2020-03-16T22:05:14.312Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-03-16T22:05:14.313Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-03-16T22:05:14.315Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2020-03-16T22:05:14.315Z INFO webdriver: DATA {
capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' }
}
2020-03-16T22:05:14.461Z DEBUG wdio-docker-service: 22:05:14.490 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome"
}
2020-03-16T22:05:14.464Z DEBUG wdio-docker-service: 22:05:14.493 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
2020-03-16T22:05:14.508Z DEBUG wdio-docker-service: Starting Chro[m1e5D8r4i3v9e6r3 1840.529].[0S.E3V9E8R7E.]1:0 6b i(nfd6(8)0 6f9a5i7l4e6d0:9 2C3a0ncnfo9tb 6a3s5scidg7n8 4rcefqbu1e
2020-03-16T22:05:14.509Z DEBUG wdio-docker-service: bf81bb53a-refs/branch-heads/3987@{#882}) on port 31965
2020-03-16T22:05:14.509Z DEBUG wdio-docker-service: Only local connections are allowed.
Please protect ports used by ChrosmeDtreidv eard darneds sr e(l9a9t)e
2020-03-16T22:05:14.510Z DEBUG wdio-docker-service: d test frameworks to prevent access by malicious code.
2020-03-16T22:05:15.313Z DEBUG wdio-docker-service: 22:05:15.342 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
2020-03-16T22:05:15.374Z DEBUG wdio-docker-service: 22:05:15.403 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 0488ca55b2f225efc8fbb340896f129b (org.openqa.selenium.chrome.ChromeDriverService)
[0-0] (node:5874) UnhandledPromiseRejectionWarning: Error: socket hang up
at connResetException (internal/errors.js:561:14)
at Socket.socketOnEnd (_http_client.js:440:23)
at Socket.emit (events.js:214:15)
at Socket.EventEmitter.emit (domain.js:476:20)
at endReadableNT (_stream_readable.js:1178:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
[0-0] (node:5874) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5874) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^Z
[4]+ Stopped npm run test:docker
Config of WebdriverIO
package.json file
Test
Steps to reproduce the behavior
In wdio config, use services: ['docker', ['devtools', { debuggerAddress: 'localhost:9222' }]] and run any simple test.
Expected behavior
Test should run in the docker container along with devtools service which will provide performance metrics.
The text was updated successfully, but these errors were encountered: