Skip to content

#373 - Finalize the initialized tasks when the process fails - #379

Merged
njoubert-cleverage merged 2 commits into
mainfrom
373
Oct 23, 2026
Merged

njoubert-cleverage merged 2 commits into
mainfrom
373

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #373.

ProcessManager now finalizes the tasks (FinalizableTaskInterface::finalize()) when the process fails too, so that a long-running worker (Messenger, UI bundle) no longer keeps the resources of a failed process open (files of the CSV / JSON stream / XML tasks, cursor of doctrine_database_reader).

  • Only the tasks that have been initialized are finalized (not a task whose initialize() failed, nor the tasks not reached), each one only once (a failure after the normal finalization does not finalize again).
  • The process history is flagged as failed before the finalization: finalize() can check $state->getProcessHistory()->isFailed() to skip footers / publishing on failure.
  • A finalization failure is logged as critical with its task (as in the normal finalization), the next tasks are still finalized and the original exception is rethrown unchanged; the failing task is kept for the logs of the failure (ProcessManager: the task configuration used by the logs is not restored after a child task or a sub-process #333).
  • StatCounterTask logs its count when the process fails too.
  • UPGRADE.md: new v5.6 section.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None for working processes: the success path is unchanged. Contract change of FinalizableTaskInterface::finalize(), now also called when the process fails (see UPGRADE.md): a custom finalize() must not assume the data are complete.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage requested a review from a team as a code owner October 23, 2026 14:39
@njoubert-cleverage
njoubert-cleverage merged commit eab0317 into main Oct 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The tasks are not finalized when the process fails: resources left open in a long-running worker

1 participant