Skip to content
This repository has been archived by the owner on Jun 20, 2020. It is now read-only.

could not list chrome tabs: Error: connect ECONNREFUSED 127.0.0.1:9222 #61

Open
msaus opened this issue Jun 26, 2019 · 12 comments
Open

Comments

@msaus
Copy link

msaus commented Jun 26, 2019

I often get this error after running for while.
Also, when I get this error, I have to restart the node process.

Do you have any suggestion for this?

Google Chrome 70.0.3538.110

@paps
Copy link
Member

paps commented Jun 28, 2019

Maybe you have too many open tabs? Are you closing the tabs you're not using?

"After running for a while" means about how long?

@msaus
Copy link
Author

msaus commented Jul 8, 2019

I always close the tab.
After crawling 10 web site, I get this error message.

@paps
Copy link
Member

paps commented Jul 9, 2019

Does it happen on other websites? Is the website so heavy that maybe you have no memory left? What have to tried? Thx

@msaus
Copy link
Author

msaus commented Jul 10, 2019

No it dose not happened on other website.
Then, my server has 8G memory and the memory is always 3G left as well as swap not being happened.

Also, now the error happens sometimes, not often.
This is bit weird for me.

@msaus
Copy link
Author

msaus commented Jul 10, 2019

Possibly, we wait and see how things go.

@paps
Copy link
Member

paps commented Jul 10, 2019

Maybe start NickJS in debug mode (debug: true in constructor) and we can see some output showing us what's wrong

@allgrowsm
Copy link

Sorry for late reply.

I got following errors.

2019-12-12 12:28 : CHROME STDERR: [1212/122838.971585:ERROR:socket_posix.cc(145)] bind() failed: address already in use (98)
DevTools listening on ws://[::1]:9222/devtools/browser/98a1a41d-1cb9-4a6c-97e8-ca7cdb590840
2019-12-12 12:28 : > It took 103ms to start and connect to Chrome (1 tries)
2019-12-12 12:28 : Error: could not list chrome tabs: Error: connect ECONNREFUSED 127.0.0.1:9222
2019-12-12 12:28 : CHROME STDERR: 
DevTools listening on ws://127.0.0.1:9222/devtools/browser/833f02dc-74f5-484f-930e-5e5b4881d26b
2019-12-12 12:28 : > It took 256ms to start and connect to Chrome (2 tries)

@paps
Copy link
Member

paps commented Dec 13, 2019

Well, it looks like the 9222 port is already in use on your system. Maybe you already have Chrome running with debug enabled, even though NickJS tries to start a new one?

A fix would be to disable debug mode on this other Chrome instance, or at least change the port (which is one of the cmd line options of Chrome).

@allgrowsm
Copy link

@paps
Thanks for your reply.

I finally found the reason why I am getting these errors every time I access to my crawler.

I use pm2 for load balancing node process and port collision occurs because of multiple node process.

Dose nickJS has options for the port number?

@paps
Copy link
Member

paps commented Dec 26, 2019

Oh ok, I see. That means your node instances are started with debugging enabled right?

You can use additionalChildOptions (array of command line parameters) to change how Chrome is started in NickJS (this only works in the latest version, please update if necessary). But I'm afraid you will not be able to change the port number this way, this is one of the hardcoded options of NickJS. You will need to free port 9222 somehow. Or submit a PR :)

@allgrowsm
Copy link

@paps
Thanks for that.
I will take a look at that option and see if I can change port number as well as submitting PR :)

@allgrowsm
Copy link

@paps
Hi there,
I just had quick look at your source code and I understand what the hardcoded options mean.
This sort of option should be optionally set when it is constructed or after initialized.
I will have a look at this issue after the long holiday.
Happy Holiday :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants