Description
Because of https://github.com/taskforcesh/bullmq/blob/master/src/classes/worker.ts#L192-L195 , I am seeing workers get caught in an infinite loop of trying to get the next job only to error again trying to get the next job.
The loop is this:
- Redis connection is closed somehow (I assume this is my code doing this but don't have a smoking gun yet)
- worker is not closed explicitly,
this.closing
inside the worker is undefined - worker
run
loop callsgetNextJob
asynchronously, which callswaitForJob
, which callsBRPOPLPUSH
- Redis client synchronously throws, which interrupts execution of
waitForJob
, and is caught ingetNextJob
, and swallowed getNextJob
call wins thePromise.race
in workerrun
loopgetNextJob
call returns nothing, so worker doesn't work the job- worker run loop repeats the process
I am not sure why that error is being swallowed, or why the Connection is closed.
message is special. If I had to guess, special care has to be taken to handle connection closes that we expect on the blocking calls like that. In this case though, the worker has not been explicitly closed, and it's being asked to use a closed redis connection, which I think should be an error that at least gets emitted and maybe takes down the process if unhandled.
Happy to do up a PR if someone can tell me what the semantics should be!
Activity