Skip to content

fix(spider-storage): Cancel the service when a background tokio task exits on error. - #387

Merged
LinZhihao-723 merged 2 commits into
y-scope:mainfrom
LinZhihao-723:actor-failure
Jul 12, 2026
Merged

fix(spider-storage): Cancel the service when a background tokio task exits on error.#387
LinZhihao-723 merged 2 commits into
y-scope:mainfrom
LinZhihao-723:actor-failure

Conversation

@LinZhihao-723

@LinZhihao-723 LinZhihao-723 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

Before this PR, the storage runtime didn't track the background tokio tasks' status. That means the background tasks may exit silently on error. This PR fixes this issue by:

  • Adding a log statement to keep track of the service cancellation.
  • Fire the service-wise cancellation token.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Ensure all workflows pass.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of background service failures by logging errors and automatically stopping related services when critical tasks fail.
    • Enhanced shutdown behaviour for job cache cleanup and task instance management.

@LinZhihao-723
LinZhihao-723 marked this pull request as ready for review July 10, 2026 22:16
@LinZhihao-723
LinZhihao-723 requested review from a team and sitaowang1998 as code owners July 10, 2026 22:16
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Job cache GC and task instance pool actor tasks now log run failures and cancel their shared CancellationToken when errors occur.

Changes

Actor failure cancellation

Layer / File(s) Summary
Actor error handling
components/spider-storage/src/state/job_cache_gc.rs, components/spider-storage/src/task_instance_pool.rs
Spawned actor tasks inspect run errors, log them with tracing::error!, and cancel the shared CancellationToken.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • y-scope/spider#324: Introduced the cancellation-token-driven task instance pool actor factory whose failure handling is updated here.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: background Tokio task failures now trigger service cancellation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LinZhihao-723
LinZhihao-723 merged commit 6d36c43 into y-scope:main Jul 12, 2026
16 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.

2 participants