taskforcesh / bullmq

BullMQ - Message Queue and Batch processing for NodeJS and Python based on Redis
https://bullmq.io
MIT License
5.47k stars 357 forks source link

Thrown DelayedError from Sandbox processor causes 'Missing lock for job 2. failed' #2566

Closed imperfect-circuits closed 1 week ago

imperfect-circuits commented 2 weeks ago

https://github.com/taskforcesh/bullmq/blob/7d51ed749f77926ee2bfd2b1076c8cd8d3b42243/src/classes/worker.ts#L763

Becaused Sandboxed Processors create new errors (rather than just rethrowing what was made https://github.com/taskforcesh/bullmq/blob/7d51ed749f77926ee2bfd2b1076c8cd8d3b42243/src/classes/sandbox.ts#L29), and the check is done on 'message' rather than name, a thrown DelayedError is not read properly, causing the 'Missing lock for job' error.

I used the Process Step Jobs process (and delayed a job but with a timeout (yes, the timeout I used was not of a timestamp, but just the seconds), and I got the aforementioned error.

await job.moveToDelayed(500, token); throw new DelayedError(The error occured);`