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

When the OS closes a child process, causes an ERR_IPC_CHANNEL_CLOSED exception, causing the master process to fail. #1460

Closed
pandres95 opened this issue Sep 9, 2019 · 0 comments · Fixed by #1461

Comments

@pandres95
Copy link
Contributor

pandres95 commented Sep 9, 2019

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

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

Successfully merging a pull request may close this issue.

1 participant