When the OS closes a child process, causes an ERR_IPC_CHANNEL_CLOSED exception, causing the master process to fail.
Created by: pandres95
Description
If the OS (or anyone else) closes the child process, instead of checking its signalCode
, the child is released in the pool. This causes an error that leads, when trying to send that child another message, to fail, causing an uncaughtException
that closes the main process.
Related error and detais: here
Minimal, Working Test code to reproduce the issue.
Create a project using these two files, that depends on Bull@3.10.0
index.js
'use strict';
const { resolve } = require('path');
const Bull = require('bull');
async function main() {
const queue = new Bull('myqueue', {
redis: 'redis://localhost:6379',
settings: {
lockDuration: 100000, // Key expiration time for job locks.
stalledInterval: 100000, // How often check for stalled jobs (use 0 for never checking).
maxStalledCount: 10, // Max amount of times a stalled job will be re-processed.
guardInterval: 1000, // Poll interval for delayed jobs and added jobs.
retryProcessDelay: 5000, // delay before processing next job in case of internal error.
drainDelay: 20
}
});
try {
queue.process(resolve(__dirname, './process/index.js'));
await queue.add({ hello: 'world' });
await queue.add({ hello: 'world' });
} catch (error) {
throw error;
}
}
main();
process/index.js
'use strict';
const setTimeoutPromise = timeout => new Promise(resolve => setTimeout(() => resolve(), timeout));
module.exports = async function () {
try {
console.log('opening /my/little/pony.txt');
await setTimeoutPromise(100000);
console.log('/my/little/pony.txt opened');
} catch (error) {
console.error(error);
}
};
Open the main process. Run:
node index.js
Kill the child process. Run:
ps -ax | grep master.js | awk '{print $1}' | xargs -I % kill -9 %
Bull version
3.10.0
Additional information
N/A