chill117 / proxy-verifier

NodeJS module to check proxies: if functional, anonymity level, tunneling, supported protocols.
MIT License
76 stars 16 forks source link

gatherproxy crashed and server restart #14

Closed cyclops24 closed 8 years ago

cyclops24 commented 8 years ago

Hi @chill117, Today my app crash with below code adn server restarted:

W20160805-21:31:20.135(4.5)? (STDERR) /home/username/Projects/Proxy Assistant/Sources/node_modules/proxy-lists/sources/gatherproxy.js:313
W20160805-21:31:20.136(4.5)? (STDERR)       return cookie.substr(0, cookie.indexOf(';'));
W20160805-21:31:20.137(4.5)? (STDERR)                    ^
W20160805-21:31:20.137(4.5)? (STDERR) 
W20160805-21:31:20.137(4.5)? (STDERR) TypeError: Cannot read property 'substr' of undefined
W20160805-21:31:20.138(4.5)? (STDERR)     at Object.module.exports.getSessionCookie (/home/username/Projects/Proxy Assistant/Sources/node_modules/proxy-lists/sources/gatherproxy.js:313:16)
W20160805-21:31:20.138(4.5)? (STDERR)     at Request._callback (/home/username/Projects/Proxy Assistant/Sources/node_modules/proxy-lists/sources/gatherproxy.js:211:24)
W20160805-21:31:20.139(4.5)? (STDERR)     at Request.self.callback (/home/username/Projects/Proxy Assistant/Sources/node_modules/request/request.js:200:22)
W20160805-21:31:20.139(4.5)? (STDERR)     at emitTwo (events.js:87:13)
W20160805-21:31:20.139(4.5)? (STDERR)     at Request.emit (events.js:172:7)
W20160805-21:31:20.140(4.5)? (STDERR)     at Request.<anonymous> (/home/username/Projects/Proxy Assistant/Sources/node_modules/request/request.js:1067:10)
W20160805-21:31:20.140(4.5)? (STDERR)     at emitOne (events.js:82:20)
W20160805-21:31:20.140(4.5)? (STDERR)     at Request.emit (events.js:169:7)
W20160805-21:31:20.140(4.5)? (STDERR)     at IncomingMessage.<anonymous> (/home/username/Projects/Proxy Assistant/Sources/node_modules/request/request.js:988:12)
W20160805-21:31:20.141(4.5)? (STDERR)     at emitNone (events.js:72:20)
=> Exited with code: 1

I think manybe gatherproxy breaks. I think it's better to prevent server restart on error's like this or this.

chill117 commented 8 years ago

You can prevent your node app from crashing by adding the following anywhere in your application code:

process.on('uncaughtException', function(error) {
    console.log(error);
});

Other than that, the stack trace here looks straight-forward. I should have time to fix it in the next couple days or week.

Edit: I noticed that this error seems to be caused by the proxy-lists module, not proxy-verifier.

I've created an issue for that module, and will close this one here.