Skip to content
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

isDebuggerReady() net.createConnection ECONNREFUSED error in AWS ec2 instance #30

Open
hekod777 opened this issue Sep 22, 2017 · 3 comments

Comments

@hekod777
Copy link

hekod777 commented Sep 22, 2017

Hello

I was trying to run Rendertron using npm start in an AWS ec2 instance to avoid the docker container performance penalty.

then I got this error after npm start

bot-render@1.0.0 start /home/ec2-user/rendertron
node src/main.js
{ Error: connect ECONNREFUSED 127.0.0.1:33465
at Object._errnoException (util.js:1026:11)
at _exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 33465 }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bot-render@1.0.0 start: node src/main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bot-render@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The root of the problem was the isDebuggerReady() {} in chrome launcher. It seems that net.createConnection can never properly create a connection.

However, everything is running fine locally.

any ideas how to fix it?

Reproduction Steps

  1. start an AWS ec2 instance with AMI

  2. connect to the ec2 instance

  3. install git sudo yum install git

  4. pull rendertron repo

  5. git clone https://github.com/GoogleChrome/rendertron.git

  6. install chrome
    sudo yum --nogpgcheck localinstall https://intoli.com/blog/installing-google-chrome-on-centos/google-chrome-stable-60.0.3112.113-1.x86_64.rpm

  7. cd into rendertron folder cd rendertron

  8. npm install

  9. npm start

Tried work arounds

  • comment out yield this.waitUntilReady(); in chrome-launcher.js in the spawnProcess function. Rendertron was able to run, but if I try to render a page, it will give the following error.

Uncaught exception
{ Error: connect ECONNREFUSED 127.0.0.1:38585
at Object._errnoException (util.js:1026:11)
at _exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 38585 }

  • Increase the pollInterval to 50000ms. And simply the same result.
    net.createConnection() simply throws ECONNREFUSED error as soon as it tries to create a connection.

Thanks!

@hekod777 hekod777 changed the title isDebuggerReady() net.createConnection ECONNREFUSED error isDebuggerReady() net.createConnection ECONNREFUSED error in AWS ec2 instance Sep 22, 2017
@patrickhulce
Copy link
Collaborator

@hekod777 rendertron is using an older version of chrome-launcher (~0.3 instead of latest 0.8) which has a few mitigations that might help (though it looks like you've already tried increasing the poll interval).

Can you confirm that Chrome is actually starting successfully through other means? i.e. you can connect to the port from another process after you increase the poll interval. It's possible it's silently failing to start.

@hekod777
Copy link
Author

@patrickhulce I think chrome was actually running because I have the following line in the logs

ChromeLauncher Chrome running with pid 5782 on port 46423.

and I have upgrade chrome-launcher to 0.8+. but still the same error.

The debugger is where pain is.

@hekod777
Copy link
Author

hekod777 commented Sep 22, 2017

I modified isDebuggerReady(){} to see the more information

isDebuggerReady() {
        return new Promise((resolve, reject) => {
            const client = net.createConnection(this.port);
            console.log('the client is ' + client);
            console.log('the port is ' + this.port);
            client.once('error', err => {
                console.log('is debugger ready error ' + err);
                this.cleanup(client);
                reject(err);
            });
            client.once('connect', () => {
                this.cleanup(client);
                resolve();
            });
        });
    }

This is what I saw

1
Chrome LauncherWaiting for browser...
the client is [object Object]
the port is 33371
is debugger ready error Error: connect ECONNREFUSED 127.0.0.1:33371
2
Chrome LauncherWaiting for browser.....
the client is [object Object]
the port is 33371
is debugger ready error Error: connect ECONNREFUSED 127.0.0.1:33371
3
Chrome LauncherWaiting for browser.......
the client is [object Object]
the port is 33371
is debugger ready error Error: connect ECONNREFUSED 127.0.0.1:33371

PS: I also tried using red hat 7.4 linux instead of Amazon Linux AMI. but still the same error

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

No branches or pull requests

2 participants