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
  • #2213
Closed
Open
Issue created Nov 12, 2021 by Administrator@rootContributor

Errors thrown inside of queue "completed" handler result in "Missing lock" errors

Created by: sysrun

This one gave me hours of pain...

Description

If an error is throw inside the queue "completed" handler, the queues "error" event will be triggered with "Error: Missing lock for job failed" and errorMessage "Error processing job".

Minimal, Working Test code to reproduce the issue.

After the second iteration the described error will be triggered

const bull = require('bull');

const queue = bull('testqueue', 'redis://localhost:6380');

queue.process(async (job) => {
  console.log('>> processing', job.id);
  return Promise.resolve(true);
});

queue.on('completed', (job, result) => {
  console.log('>>> completed', job.id);
  if (job.data.counter >= 2) {
    console.log('>>> counter >= 2, throwing inside "completed" handler');
    throw Error();
  }
});

queue.on('error', (error, errorMessage) => {
  console.error('error', error);
  console.error('errorMessage', errorMessage);
});

let counter = 0;
setInterval(() => {
  const job = queue.add({counter: counter++});
  console.log('> added job', job.id);
}, 1000);

Bull version

4.1.0

Assignee
Assign to
Time tracking