{"action":"created","issue":{"url":"https://api.github.com/repos/OptimalBits/bull/issues/370","repository_url":"https://api.github.com/repos/OptimalBits/bull","labels_url":"https://api.github.com/repos/OptimalBits/bull/issues/370/labels{/name}","comments_url":"https://api.github.com/repos/OptimalBits/bull/issues/370/comments","events_url":"https://api.github.com/repos/OptimalBits/bull/issues/370/events","html_url":"https://github.com/OptimalBits/bull/issues/370","id":188362151,"number":370,"title":"Jobs can be processed and left in the `wait` state","user":{"login":"bradvogel","id":821706,"avatar_url":"https://avatars.githubusercontent.com/u/821706?v=3","gravatar_id":"","url":"https://api.github.com/users/bradvogel","html_url":"https://github.com/bradvogel","followers_url":"https://api.github.com/users/bradvogel/followers","following_url":"https://api.github.com/users/bradvogel/following{/other_user}","gists_url":"https://api.github.com/users/bradvogel/gists{/gist_id}","starred_url":"https://api.github.com/users/bradvogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradvogel/subscriptions","organizations_url":"https://api.github.com/users/bradvogel/orgs","repos_url":"https://api.github.com/users/bradvogel/repos","events_url":"https://api.github.com/users/bradvogel/events{/privacy}","received_events_url":"https://api.github.com/users/bradvogel/received_events","type":"User","site_admin":false},"labels":[{"id":45333491,"url":"https://api.github.com/repos/OptimalBits/bull/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-09T21:53:46Z","updated_at":"2016-11-13T03:21:41Z","closed_at":null,"body":"@manast Following the discussion in https://github.com/OptimalBits/bull/pull/359, I found a hazard that I think we should address before releasing a new version: a job can be processed an still left in wait. Here's how:\r\n\r\n| Time | Process A | Process B |\r\n| --- | --- | --- |\r\n| 1 | In the regular Bull run loop of Process A, getNextJob moves a job from `wait` to `active` |  |\r\n| 2 |  | In Process B, `moveUnlockedJobsToWait` happens to run and pick up the job in step 1, and moves it back to wait |\r\n| 3 | Process A gets lock on the job (that is now in 'wait') and begins to process it | |\r\n\r\nIf there is no other process around to move the job back to `active` then Process A will complete the job and leave it in `wait`. This can lead to a data inconsistency."},"comment":{"url":"https://api.github.com/repos/OptimalBits/bull/issues/comments/260164427","html_url":"https://github.com/OptimalBits/bull/issues/370#issuecomment-260164427","issue_url":"https://api.github.com/repos/OptimalBits/bull/issues/370","id":260164427,"user":{"login":"bradvogel","id":821706,"avatar_url":"https://avatars.githubusercontent.com/u/821706?v=3","gravatar_id":"","url":"https://api.github.com/users/bradvogel","html_url":"https://github.com/bradvogel","followers_url":"https://api.github.com/users/bradvogel/followers","following_url":"https://api.github.com/users/bradvogel/following{/other_user}","gists_url":"https://api.github.com/users/bradvogel/gists{/gist_id}","starred_url":"https://api.github.com/users/bradvogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradvogel/subscriptions","organizations_url":"https://api.github.com/users/bradvogel/orgs","repos_url":"https://api.github.com/users/bradvogel/repos","events_url":"https://api.github.com/users/bradvogel/events{/privacy}","received_events_url":"https://api.github.com/users/bradvogel/received_events","type":"User","site_admin":false},"created_at":"2016-11-13T03:21:41Z","updated_at":"2016-11-13T03:21:41Z","body":"#371 describes a more dangerous case: a job can get double processed because a worker is allowed to take the lock while the job is in `completed`, cc @doublerebel "}}
{"actor":{"display_login":"bradvogel"}}