Skip to content

fix(spider-storage): Add DeleteResourceGroup and ResendReadyTasks. - #366

Closed
sitaowang1998 wants to merge 37 commits into
y-scope:mainfrom
sitaowang1998:add-missing-services
Closed

fix(spider-storage): Add DeleteResourceGroup and ResendReadyTasks.#366
sitaowang1998 wants to merge 37 commits into
y-scope:mainfrom
sitaowang1998:add-missing-services

Conversation

@sitaowang1998

@sitaowang1998 sitaowang1998 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Description

Note

This PR depends on #364

This PR:

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

  • GitHub workflows pass.

Summary by CodeRabbit

  • New Features
    • Added full support for deleting resource groups (including password verification).
    • Added scheduler registration and scheduler listing/lookup improvements.
    • Added a recovery action to re-enqueue ready tasks after a scheduler reconnect.
  • Bug Fixes
    • Improved validation and error responses for multiple inbound requests (e.g., IP/port/time/size handling).
    • Implemented missing storage and gRPC RPCs previously returning “not implemented.”
    • Fixed in-memory job cache eviction so jobs are removed when their resource group is deleted.

sitaowang1998 and others added 30 commits June 26, 2026 16:31
# Conflicts:
#	components/spider-proto-rust/src/generated/storage.rs
#	components/spider-proto/storage/storage.proto
#	components/spider-scheduler/src/storage_client/grpc.rs
@sitaowang1998
sitaowang1998 requested a review from a team as a code owner June 29, 2026 17:39
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b1382774-b52b-408f-9067-818b260f23ea

📥 Commits

Reviewing files that changed from the base of the PR and between c998dac and e4944ab.

📒 Files selected for processing (7)
  • components/spider-client/src/client.rs
  • components/spider-client/src/grpc/resource_group.rs
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/runtime.rs
  • components/spider-scheduler/src/storage_client/grpc.rs
  • components/spider-scheduler/src/storage_client/mod.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/storage_client/mod.rs
  • components/spider-scheduler/src/storage_client/grpc.rs

Walkthrough

Adds DeleteResourceGroup end to end across proto, storage, gRPC, and client layers. It also implements previously stubbed storage RPCs for polling, resource-group, execution-manager, scheduler-registration, and session flows, and wires scheduler resend_ready_tasks support through the scheduler client.

Changes

Storage RPC Implementations and Resource Group Deletion

Layer / File(s) Summary
Proto contract and request unpacking
components/spider-proto/storage/storage.proto, components/spider-proto-rust/src/lib.rs, components/spider-proto-rust/src/scheduler_registration.rs, components/spider-proto-rust/src/unpack/storage.rs
Adds DeleteResourceGroupRequest and DeleteResourceGroup to the storage proto, exposes the scheduler registration conversion module, and adds request unpacking for resource-group, execution-manager, scheduler-registration, and polling requests.
Job cache, MariaDB delete, and service deletion
components/spider-storage/src/cache/job.rs, components/spider-storage/src/state/job_cache.rs, components/spider-storage/src/db/mariadb.rs, components/spider-storage/src/state.rs, components/spider-storage/src/state/service.rs, components/spider-storage/tests/mariadb_test.rs
Adds resource-group access on job control blocks, cache eviction by resource group, transactional database deletion, and the ServiceState::delete_resource_group path with unit and integration tests.
gRPC error mapping and RPC implementations
components/spider-storage/src/grpc.rs
Refactors storage gRPC error handling, implements inbound-queue, resource-group, execution-manager, scheduler-registration, and session RPCs, and adds gRPC tests.
Scheduler resend_ready_tasks client wiring
components/spider-scheduler/src/storage_client/mod.rs, components/spider-scheduler/src/storage_client/grpc.rs, components/spider-scheduler/src/error.rs, components/spider-scheduler/src/core_impl/round_robin/tests.rs, components/spider-scheduler/src/runtime.rs
Adds resend_ready_tasks to the scheduler storage client trait and gRPC implementation, and updates mocks and error variants to match the new API.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • y-scope/spider#323: Related storage-side resource-group and execution-manager API work in the same request-unpacking and service layers.
  • y-scope/spider#346: Related storage gRPC service implementation work in components/spider-storage/src/grpc.rs.
  • y-scope/spider#347: Related scheduler-registration plumbing and storage integration.

Suggested reviewers: LinZhihao-723

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The scheduler resend_ready_tasks wiring is added, but the required proto move out of JobOrchestrationService is not shown. Move ResendReadyTasks and its request into a dedicated scheduler-facing service in storage.proto, then update the generated server trait and scheduler client calls.
Out of Scope Changes check ⚠️ Warning The DeleteResourceGroup database, cache, client, and test changes are unrelated to linked issue #352 and expand the PR scope. Split DeleteResourceGroup into a separate PR or add the matching linked issue; keep this PR limited to the ResendReadyTasks service move.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the main themes of the PR: DeleteResourceGroup plus ResendReadyTasks work.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
components/spider-storage/src/grpc.rs (1)

1303-1326: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the returned task_id in the ready-task test.

build_ready_tasks now owns the lane-specific task-id conversion contract, but this test only checks resource group and job IDs. Add an assertion for TaskId::Index(TASK_INDEX) so regressions in the protobuf task-id mapping are caught.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/spider-storage/src/grpc.rs` around lines 1303 - 1326, The
ready-task test in poll_ready_tasks_returns_entries is missing coverage for the
task-id mapping returned by build_ready_tasks. Update the assertions to verify
the first task’s task_id equals TaskId::Index(TASK_INDEX) in addition to the
existing resource_group_id and job_id checks, so regressions in the protobuf
task-id conversion are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/spider-storage/src/grpc.rs`:
- Around line 254-263: The
`StorageServerError::Cache(CacheError::Internal(InternalError::ReadyQueueChannelClosed))`
match arm in `grpc.rs` only returns an internal status and skips the
service-cancellation path. Update this branch so `ReadyQueueChannelClosed` is
handled the same way as the broader broken-queue failure path, triggering
cancellation/restart logic instead of just logging and returning
`Status::internal`. Keep the existing `StorageServerError`/`CacheError` match
structure but ensure the closed inbound queue causes the service to stop
accepting work.

In `@components/spider-storage/src/state/service.rs`:
- Around line 551-562: Serialize resource-group deletion with in-flight job
registration so the DB and cache updates stay linearizable for the same resource
group. Update `delete_resource_group` and `register_job` to use the same
per-resource-group exclusion or equivalent guard around the
`self.inner.db.delete`, `self.inner.job_cache.remove_by_resource_group`, and JCB
insertion path. This prevents `register_job` from recreating a cached job after
a group has already been deleted.
- Around line 557-562: Deletion in the service path currently removes the DB
rows and job cache via inner.db.delete and
inner.job_cache.remove_by_resource_group, but it leaves already-queued ready
work eligible for polling. Update the deletion flow in the resource-group delete
logic to also purge or invalidate any queued entries associated with that
resource group, or make the poll path filter queued items against live cache
state before returning them. Use the deletion code around inner.db.delete and
remove_by_resource_group as the place to ensure no stale ready work from deleted
jobs can be dispatched.

---

Nitpick comments:
In `@components/spider-storage/src/grpc.rs`:
- Around line 1303-1326: The ready-task test in poll_ready_tasks_returns_entries
is missing coverage for the task-id mapping returned by build_ready_tasks.
Update the assertions to verify the first task’s task_id equals
TaskId::Index(TASK_INDEX) in addition to the existing resource_group_id and
job_id checks, so regressions in the protobuf task-id conversion are caught.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 91369f7f-6583-467a-8682-9260935ee5c4

📥 Commits

Reviewing files that changed from the base of the PR and between c0fe56f and c998dac.

⛔ Files ignored due to path filters (1)
  • components/spider-proto-rust/src/generated/storage.rs is excluded by !**/generated/**
📒 Files selected for processing (15)
  • components/spider-proto-rust/src/lib.rs
  • components/spider-proto-rust/src/scheduler_registration.rs
  • components/spider-proto-rust/src/unpack/storage.rs
  • components/spider-proto/storage/storage.proto
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/storage_client/grpc.rs
  • components/spider-scheduler/src/storage_client/mod.rs
  • components/spider-storage/src/cache/job.rs
  • components/spider-storage/src/db/mariadb.rs
  • components/spider-storage/src/grpc.rs
  • components/spider-storage/src/state.rs
  • components/spider-storage/src/state/job_cache.rs
  • components/spider-storage/src/state/service.rs
  • components/spider-storage/tests/mariadb_test.rs
💤 Files with no reviewable changes (1)
  • components/spider-scheduler/src/error.rs

Comment on lines +254 to +263
StorageServerError::Cache(CacheError::Internal(
InternalError::ReadyQueueChannelClosed,
)) => {
tracing::warn!(
service = SERVICE_NAME,
tag,
"Inbound queue channel is closed."
);
Status::internal("inbound queue is closed")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Cancel the service when the inbound queue channel is closed.

This branch shadows the broader CacheError::Internal(e) arm, so ReadyQueueChannelClosed returns INTERNAL but never triggers the cancellation/restart path. Since the queue can no longer yield entries, keeping the service alive leaves schedulers repeatedly hitting a permanently broken inbound queue.

Proposed fix
             StorageServerError::Cache(CacheError::Internal(
                 InternalError::ReadyQueueChannelClosed,
             )) => {
                 tracing::warn!(
                     service = SERVICE_NAME,
                     tag,
                     "Inbound queue channel is closed."
                 );
+                self.cancellation_token.cancel();
                 Status::internal("inbound queue is closed")
             }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
StorageServerError::Cache(CacheError::Internal(
InternalError::ReadyQueueChannelClosed,
)) => {
tracing::warn!(
service = SERVICE_NAME,
tag,
"Inbound queue channel is closed."
);
Status::internal("inbound queue is closed")
}
StorageServerError::Cache(CacheError::Internal(
InternalError::ReadyQueueChannelClosed,
)) => {
tracing::warn!(
service = SERVICE_NAME,
tag,
"Inbound queue channel is closed."
);
self.cancellation_token.cancel();
Status::internal("inbound queue is closed")
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/spider-storage/src/grpc.rs` around lines 254 - 263, The
`StorageServerError::Cache(CacheError::Internal(InternalError::ReadyQueueChannelClosed))`
match arm in `grpc.rs` only returns an internal status and skips the
service-cancellation path. Update this branch so `ReadyQueueChannelClosed` is
handled the same way as the broader broken-queue failure path, triggering
cancellation/restart logic instead of just logging and returning
`Status::internal`. Keep the existing `StorageServerError`/`CacheError` match
structure but ensure the closed inbound queue causes the service to stop
accepting work.

Comment on lines +551 to +562
pub async fn delete_resource_group(
&self,
resource_group_id: ResourceGroupId,
password: &[u8],
) -> Result<(), StorageServerError> {
self.inner.db.verify(resource_group_id, password).await?;
self.inner.db.delete(resource_group_id).await?;
let evicted_jobs = self
.inner
.job_cache
.remove_by_resource_group(resource_group_id)
.await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Serialize resource-group deletion against in-flight job registration.

register_job persists the job before it builds and inserts the JCB, while this path deletes the DB rows before it evicts cached JCBs. If both run concurrently for the same resource group, delete can remove the DB state and then the register path can still insert a fresh JCB afterwards, leaving a ghost cached job for a deleted group. Please put register/delete behind the same per-resource-group exclusion or otherwise make the DB+cache update linearizable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/spider-storage/src/state/service.rs` around lines 551 - 562,
Serialize resource-group deletion with in-flight job registration so the DB and
cache updates stay linearizable for the same resource group. Update
`delete_resource_group` and `register_job` to use the same per-resource-group
exclusion or equivalent guard around the `self.inner.db.delete`,
`self.inner.job_cache.remove_by_resource_group`, and JCB insertion path. This
prevents `register_job` from recreating a cached job after a group has already
been deleted.

Comment on lines +557 to +562
self.inner.db.delete(resource_group_id).await?;
let evicted_jobs = self
.inner
.job_cache
.remove_by_resource_group(resource_group_id)
.await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Delete does not invalidate already-queued ready work.

This only removes DB rows and cached JCBs. Any entries already sitting in the ready queues will still be returned by the poll RPCs, so the scheduler can keep receiving work for jobs that no longer exist. Please purge or invalidate queued entries as part of deletion, or filter them against live cache state before returning them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/spider-storage/src/state/service.rs` around lines 557 - 562,
Deletion in the service path currently removes the DB rows and job cache via
inner.db.delete and inner.job_cache.remove_by_resource_group, but it leaves
already-queued ready work eligible for polling. Update the deletion flow in the
resource-group delete logic to also purge or invalidate any queued entries
associated with that resource group, or make the poll path filter queued items
against live cache state before returning them. Use the deletion code around
inner.db.delete and remove_by_resource_group as the place to ensure no stale
ready work from deleted jobs can be dispatched.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/spider-scheduler/src/runtime.rs`:
- Around line 66-87: The shutdown timeout path in SchedulerRuntime::stop
currently drops the core JoinHandle when tokio::time::timeout expires, leaving
the scheduler core detached and still running. Update the stop logic to keep a
borrow of self.core_join_handle, call abort() on it before returning the
SchedulerRuntimeError::Stopping timeout error, and then continue handling the
join result in stop so the core task is forcibly stopped on timeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b1382774-b52b-408f-9067-818b260f23ea

📥 Commits

Reviewing files that changed from the base of the PR and between c998dac and e4944ab.

📒 Files selected for processing (7)
  • components/spider-client/src/client.rs
  • components/spider-client/src/grpc/resource_group.rs
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/runtime.rs
  • components/spider-scheduler/src/storage_client/grpc.rs
  • components/spider-scheduler/src/storage_client/mod.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/storage_client/mod.rs
  • components/spider-scheduler/src/storage_client/grpc.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/spider-scheduler/src/runtime.rs`:
- Around line 66-87: The shutdown timeout path in SchedulerRuntime::stop
currently drops the core JoinHandle when tokio::time::timeout expires, leaving
the scheduler core detached and still running. Update the stop logic to keep a
borrow of self.core_join_handle, call abort() on it before returning the
SchedulerRuntimeError::Stopping timeout error, and then continue handling the
join result in stop so the core task is forcibly stopped on timeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b1382774-b52b-408f-9067-818b260f23ea

📥 Commits

Reviewing files that changed from the base of the PR and between c998dac and e4944ab.

📒 Files selected for processing (7)
  • components/spider-client/src/client.rs
  • components/spider-client/src/grpc/resource_group.rs
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/runtime.rs
  • components/spider-scheduler/src/storage_client/grpc.rs
  • components/spider-scheduler/src/storage_client/mod.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • components/spider-scheduler/src/core_impl/round_robin/tests.rs
  • components/spider-scheduler/src/error.rs
  • components/spider-scheduler/src/storage_client/mod.rs
  • components/spider-scheduler/src/storage_client/grpc.rs
🛑 Comments failed to post (1)
components/spider-scheduler/src/runtime.rs (1)

66-87: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '## runtime.rs outline\n'
ast-grep outline components/spider-scheduler/src/runtime.rs --view expanded || true

printf '\n## runtime.rs relevant lines\n'
nl -ba components/spider-scheduler/src/runtime.rs | sed -n '1,180p'

printf '\n## search for stop usage/docs/tests\n'
rg -n "SchedulerRuntime|stop_timeout|cancelled and joined|core_join_handle|abort\(" components/spider-scheduler -S || true

Repository: y-scope/spider

Length of output: 1453


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import pathlib
p = pathlib.Path('components/spider-scheduler/src/runtime.rs')
print(p.exists(), p.stat().st_size if p.exists() else 'missing')
PY

Repository: y-scope/spider

Length of output: 163


🌐 Web query:

Tokio JoinHandle dropped detaches task timeout &mut JoinHandle cancel-safe docs

💡 Result:

In Tokio, dropping a JoinHandle detaches the associated task [1][2]. This means the task continues to run in the background, but the owner of the JoinHandle loses the ability to join on it or retrieve its output [2][3]. Because the task is no longer tracked by that handle, any return value or panic result is effectively lost [2][4]. Regarding cancel safety, the &mut JoinHandle type is explicitly documented as cancel-safe [2][3]. If an &mut JoinHandle is used as an event in a tokio::select! branch and another branch completes first, the operation is guaranteed to be safe and the task's output will not be lost [4][5]. It is important to distinguish between dropping a JoinHandle and cancelling a task: 1. Dropping a JoinHandle detaches the task, allowing it to continue running to completion independently [2][4]. 2. To actively stop a task, you must use the JoinHandle::abort method or an AbortHandle [5][6]. Awaiting an aborted task will typically result in a cancelled JoinError [5][6]. For scenarios requiring task cancellation that respects the task's own lifecycle (e.g., stopping a loop), users typically combine aborts with cooperative cancellation patterns or utilize tools like JoinSet for managing multiple tasks [6].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- runtime.rs (around stop) ---'
nl -ba components/spider-scheduler/src/runtime.rs | sed -n '1,140p'

echo
echo '--- surrounding docs/comments in runtime.rs ---'
rg -n "cancelled and joined|stop\(|shutdown|timeout" components/spider-scheduler/src/runtime.rs -n -S || true

echo
echo '--- scheduler runtime references ---'
rg -n "SchedulerRuntime|core_join_handle|stop_timeout" components/spider-scheduler -S || true

Repository: y-scope/spider

Length of output: 225


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

path = Path('components/spider-scheduler/src/runtime.rs')
lines = path.read_text().splitlines()

def show(start, end, title):
    print(f"--- {title} ({start}-{end}) ---")
    for i in range(start-1, min(end, len(lines))):
        print(f"{i+1:4d}: {lines[i]}")
    print()

show(60, 95, "stop()")
show(280, 350, "tests around stop_runtime_on_*")
PY

Repository: y-scope/spider

Length of output: 4573


Abort the core task on shutdown timeout. When timeout(self.stop_timeout, self.core_join_handle) elapses, the JoinHandle is dropped and detached, so the scheduler core keeps running in the background with no way to stop or observe it. Borrow the handle and call abort() before returning the timeout error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/spider-scheduler/src/runtime.rs` around lines 66 - 87, The
shutdown timeout path in SchedulerRuntime::stop currently drops the core
JoinHandle when tokio::time::timeout expires, leaving the scheduler core
detached and still running. Update the stop logic to keep a borrow of
self.core_join_handle, call abort() on it before returning the
SchedulerRuntimeError::Stopping timeout error, and then continue handling the
join result in stop so the core task is forcibly stopped on timeout.

@sitaowang1998

Copy link
Copy Markdown
Collaborator Author

Closed as include change of delete resource group that should not be implemented now. Will open smaller change in another PR.

@sitaowang1998
sitaowang1998 deleted the add-missing-services branch July 3, 2026 16:01
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.

Move ResendReadyTasks RPC to a dedicated scheduler-facing service

2 participants