No inspectable targets when connecting to multiple instances of chrome
See original GitHub issueComponent | Version |
---|---|
Operating system | win10 |
Node.js | 12.16.1 |
Chrome/Chromium/… | 87 ,using chrome-launcher 0.13.4 |
chrome-remote-interface | 0.29.0 |
Is Chrome running in a container? NO
I’ve got some very basic code that launches multiple instances of chrome and connects each with CDP to an individual chrome’s debugging port (all the debugging ports are different). Usually when trying to do this with 15 instances of chrome, I recieve this error
(node:20388) UnhandledPromiseRejectionWarning: Error: No inspectable targets
at defaultTarget (C:\Users\joe\src\m3rl1n\node_modules\chrome-remote-interface\lib\chrome.js:48:23)
at Chrome._fetchDebuggerURL (C:\Users\joe\src\m3rl1n\node_modules\chrome-remote-interface\lib\chrome.js:192:28)
at async Chrome._start (C:\Users\joe\src\m3rl1n\node_modules\chrome-remote-interface\lib\chrome.js:139:25)
(node:20388) 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(). To terminate the node process on unhandled promise
rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:20388) [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.
I have not been able to determine yet where in my program this error is being thrown. This error does not always come up, for example running 10 instances of chrome will usually be fine and on occassion throw this error. When attempting to run 11 this is where I start getting errors more often.
EDIT: It seems that the error is being thrown when setting up CDP at
let client = await CDP({ port: WHATEVER_PORT_CHROME_USED });
EDIT 2: The chrome instances aren’t failing on the same port, maybe it’s due to me doing this asynchronously ???
EDIT 3: Tried firing up 20 chrome instances consecutivley with absoloutly no problem, definatly seems like an issue to asynchronously several of these instancesas the same time. (To be clear, I am first launching chrome and then launching CDP inside inside of an async function, and then proceeding to run this async function x’ number of times asynchronously for as many instances as I want using Promise#All
)
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (14 by maintainers)
There shouldn’t be any difference, the only thing is that if you experience weird crashes in Chrome try to increase the container’s shared memory.
No worries! Feel free to keep me posted.
Good luck!