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
  • #322
Closed
Open
Issue created Jul 20, 2016 by Administrator@rootContributor

Possible deadlock on Failed jobs

Created by: xdc0

I'm noticing that several failed jobs remain locked. Monitoring the TTL of the lock, I notice that it renews exactly at LOCK_RENEW_TIME / 2

The only place where such lock happens is in: https://github.com/OptimalBits/bull/blob/master/lib/queue.js#L570

By inspecting the logic, I think there is a race condition that is causing a deadlock to take place:

  1. A job starts being processed and a lock renew loop kicks off
  2. A job fails and gets moved to failed
  3. Just there, the lock renew function calls itself again and attempts to renew the lock
  4. Before step 3 is completed, the timer is cleared by the finally clause in https://github.com/OptimalBits/bull/blob/27321806a95d07439412ffc666088cdd9ebadaa4/lib/queue.js#L627
  5. The lock renew function completes and sets the timer again in https://github.com/OptimalBits/bull/blob/27321806a95d07439412ffc666088cdd9ebadaa4/lib/queue.js#L570
Assignee
Assign to
Time tracking