Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bull
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 175
    • Issues 175
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OptimalBits
  • bull
  • Issues
  • #812
Closed
Open
Issue created Dec 12, 2017 by Administrator@rootContributor

process doesn't terminate on `queue.close()`

Created by: Ilaiwi

Hi,

I am using a queue to execute some jobs using child process. After all jobs are completed I want to close the queue and kill the child process responsible for executing the job.

according to the src calling queue.close() will send a signal to kill the child process https://github.com/OptimalBits/bull/blob/master/lib/process/child-pool.js#L56

But in action, this doesn't happen and the process becomes a zombie process long after I closed the queue.

I debugged the src and what I figured out that the signal sent to the child process to kill is 0 (which doesn't kill the process) and there is no way to send another signal.

https://github.com/OptimalBits/bull/blob/master/lib/process/child-pool.js#L51

Am I doing something wrong or is it a bug?

src to reproduce:

index.js

var Queue = require('bull');
var process = require('process')

const qPromise = new Queue('test promisesss', {
    redis:{
        port: 6379,
        host: 'localhost',
    },
});


qPromise.process(__dirname+'/process')


qPromise.add({notification_id:"1",total:100, current:0},{
    // jobId: "-1",
})
qPromise.add({notification_id:"2",total:200, current:0},{
    // jobId: "-2",
})
qPromise.add({notification_id:"4",total:300, current:0},{
    // jobId: "-3",
})

qPromise.on('completed', function(job, result){
    console.log("job complete", job.id, result)
    Promise.all([qPromise.getWaitingCount(),qPromise.getActiveCount()]).then( ([waitingCount,activeCount]) => {
        if(!waitingCount+activeCount){
            console.log("draiiiin")
            qPromise.close()
        }
    })
})

process.js

var Queue = require('bull');
var process = require('process')
const qPromise = new Queue('test promises', {
    redis:{
        port: 6379,
        host: 'localhost',
    },
});
console.log('processID  ', process.pid)

module.exports = async function executeJob(job){
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log(job.data)
            resolve(job.data.total)
        }, 1000);
    })
}
Assignee
Assign to
Time tracking