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
  • #1415
Closed
Open
Issue created Aug 04, 2019 by Administrator@rootContributor

Missing lock for job failed when closing queue and job takes more than 30 seconds to complete [BUG]

Created by: misos1

Description

Seems job which takes more than 30 seconds to complete is not properly finished when is queue closing and in next runs is announces as stalled. Additionally it takes another 5 seconds to gracefully exit after is queue closed which does not happen when job takes less than 30 seconds to complete.

Minimal, Working Test code to reproduce the issue.

let Promise = require("bluebird");
let Queue = require("bull");
let queue = new Queue("queue");
queue.process(10, _job => Promise.delay(40000));
queue.on("error", (...errs) => console.log(new Date(), "queue error:", ...errs.reverse()));
queue.on("stalled", job => console.log(new Date(), "stalled", job.id));
(async function()
{
	let job = await queue.add({});
	console.log(new Date(), "added", job.id);
	await Promise.delay(1000);
	await queue.close();
	console.log(new Date(), "closed");
})();
process.on("exit", () => console.log(new Date(), "exiting"));

Possible output after few runs:

2019-08-04T21:14:37.362Z added 1
2019-08-04T21:15:17.379Z queue error: Error processing job Error: Missing lock for job 1 failed
    at Object.finishedErrors (node_modules/bull/lib/scripts.js:182:16)
    at node_modules/bull/lib/job.js:268:31
    at processTicksAndRejections (internal/process/task_queues.js:82:5)
2019-08-04T21:15:17.382Z closed
2019-08-04T21:15:22.382Z exiting
2019-08-04T21:15:24.398Z added 2
2019-08-04T21:16:04.414Z queue error: Error processing job Error: Missing lock for job 2 failed
    at Object.finishedErrors (node_modules/bull/lib/scripts.js:182:16)
    at node_modules/bull/lib/job.js:268:31
    at processTicksAndRejections (internal/process/task_queues.js:82:5)
2019-08-04T21:16:04.416Z closed
2019-08-04T21:16:09.421Z exiting
2019-08-04T21:16:11.091Z added 3
2019-08-04T21:16:11.096Z stalled 1
2019-08-04T21:16:51.106Z queue error: Error processing job Error: Missing lock for job 1 failed
    at Object.finishedErrors (node_modules/bull/lib/scripts.js:182:16)
    at node_modules/bull/lib/job.js:268:31
    at processTicksAndRejections (internal/process/task_queues.js:82:5)
2019-08-04T21:16:51.107Z queue error: Error processing job Error: Missing lock for job 3 failed
    at Object.finishedErrors (node_modules/bull/lib/scripts.js:182:16)
    at node_modules/bull/lib/job.js:268:31
    at processTicksAndRejections (internal/process/task_queues.js:82:5)
2019-08-04T21:16:51.108Z closed
2019-08-04T21:16:56.108Z exiting

Bull version

3.10.0

Additional information

Nothing which I described happens if I change it to 20 seconds:

queue.process(10, _job => Promise.delay(20000));
2019-08-04T21:29:58.423Z added 1
2019-08-04T21:30:18.439Z closed
2019-08-04T21:30:18.439Z exiting
2019-08-04T21:30:23.516Z added 2
2019-08-04T21:30:43.531Z closed
2019-08-04T21:30:43.532Z exiting
2019-08-04T21:30:45.734Z added 3
2019-08-04T21:31:05.750Z closed
2019-08-04T21:31:05.750Z exiting
Assignee
Assign to
Time tracking