Skip to content

Navigation Menu

Sign in
Sign up

Handling WorkerLostError #409

Santifire92 started this conversation in General
Aug 9, 2024 · 1 comments · 3 replies
Discussion options

Hi, @auvipy !
I have a question, how can we handle this scenario where a worker gets lost abruptly like with a sigkill?
In the case of a timeout, i see you raise the exception so it gets propagated upwards, but with the worker lost, it just gets caught and passes as if nothing happened to the upper method caller.

Can this be raised/what can i do?

billiard/billiard/pool.py

Lines 1263 to 1273 in 81cc942

def mark_as_worker_lost(self, job, exitcode):
try:
raise WorkerLostError(
'Worker exited prematurely: {0} Job: {1}.'.format(
human_status(exitcode), job._job),
)
except WorkerLostError:
job._set(None, (False, ExceptionInfo()))
else: # pragma: no cover
pass
You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

When a worker is lost, a new one should be instantiated instead.
Is that not the case?

You must be logged in to vote
3 replies
Comment options

Hello, thanks so much for answering!
It DOES get reinstantiated, my problem is that it requeues the failed task in an infinite loop ignoring retries flag (i think because this exception doesnt get propagated) so if you have a task that always fails by lets say memory consumption, it will requeue and fail in an infinite loop.

How do you handle this scenario?

Task starts -> worker gets sigkilled -> task requeues
Task starts -> worker gets sigkilled -> task requeues
Task starts -> worker gets sigkilled -> task requeues
...

add infinitum

Comment options

This is the normal behavior for Billiard. You need to cancel the request to execute the task somehow.
If this is a Celery issue, revoking the task could do the trick.

Comment options

Thanks so much for clarifying the behaviour!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /