I have been using node pool for a while. When doing single requests tests, all works fine but when I rapidly send requests to the phantomjs, then I get a lot of crash errors in the console. The common one which I can catch is
Error: Error reading from stdin: Error: This socket has been ended by the other party
1|www | at Phantom._rejectAllCommands (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.js:373:
41)
1|www | at Phantom.kill (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.js:351:14)
1|www | at Socket.Phantom.process.stdin.on.e (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.
js:186:18)
1|www | at emitOne (events.js:96:13)
1|www | at Socket.emit (events.js:188:7)
1|www | at Socket.writeAfterFIN [as write] (net.js:294:8)
1|www | at Phantom.executeCommand (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.js:268:28)
1|www | at Phantom.execute (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.js:284:21)
1|www | at Phantom.createPage (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.js:211:21)
1|www | at Promise (/home/node/controllers/modules/phantomjs/index.js:41:20)
1|www | at pool.use (/home/node/controllers/modules/phantomjs/index.js:39:16)
1|www | at process._tickDomainCallback (internal/process/next_tick.js:129:7)
Other ones that I get are :
(node:4177) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 42): Error: Phantom process stopped with exit code null
and
error: PhantomJS has crashed. Please read the bug reporting guide at1
and
| You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
1|www | Error: Phantom process stopped with exit code null
1|www | at Phantom._rejectAllCommands (/home/node/node_modules/phantom-pool/node_modules/phantom/lib/phantom.js:373:41)
Here is my pool code:
const pool = phantomPool({
max: 20, // default
min: 2, // default
idleTimeoutMillis: 15000, // default.
maxUses: 20, // default
validator: () => Promise.resolve(true), // defaults to always resolving true
testOnBorrow: true, // default
phantomArgs: [[], {
logLevel: 'warn',
}], // arguments passed to phantomjs-node directly, default is `[]`. For all opts, see
// https://github.com/amir20/phantomjs-node#phantom-object-api
});
And my pool.use code:
function phantomChecks(url) {
return new Promise((rosolve1, reject1)=> {
try {
pool.use((instance) => {
return new Promise((resolve, reject) => {
});
});
} catch(error){
reject1(error);
}
});
}
I don't know to catch those errors and handle them as 2 promises and one try and catch statement is not doing it. Also, Is it okay to return a promise inside pool.use method?
Hi All,
I have been using node pool for a while. When doing single requests tests, all works fine but when I rapidly send requests to the phantomjs, then I get a lot of crash errors in the console. The common one which I can catch is
Other ones that I get are :
Here is my pool code:
And my pool.use code:
I don't know to catch those errors and handle them as 2 promises and one try and catch statement is not doing it. Also, Is it okay to return a promise inside pool.use method?
Thanks