Skip to content

Commit

Permalink
Add logging around certain ways a task can fail
Browse files Browse the repository at this point in the history
This adds some logging for cases, where the task executing process dies
unexpectedly (e.g. OOM) and is unable to properly set the task state and
error reason.

fixes #9666
  • Loading branch information
mdellweg committed Jan 10, 2022
1 parent d767beb commit 3ad28ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/9666.bugfix
@@ -0,0 +1 @@
Added proper logging around certain ways a task could fail.
15 changes: 15 additions & 0 deletions pulpcore/tasking/pulpcore_worker.py
Expand Up @@ -301,6 +301,21 @@ def supervise_task(self, task):
cancel_reason = "Aborted during worker shutdown."
break
task_process.join()
if not cancel_state and task_process.exitcode != 0:
_logger.info(
_("Task process for %s exited with non zero exitcode %i."),
task.pk,
task_process.exitcode,
)
cancel_state = TASK_STATES.FAILED
if task_process.exitcode < 0:
cancel_reason = "Killed by signal {sig_num}.".format(
sig_num=-task_process.exitcode
)
else:
cancel_reason = "Task process died unexpectedly with exitcode {code}.".format(
code=task_process.exitcode
)
if cancel_state:
self.cancel_abandoned_task(task, cancel_state, cancel_reason)
if task.reserved_resources_record:
Expand Down

0 comments on commit 3ad28ca

Please sign in to comment.