Skip to content

Fix schedule_from task cleanup before start - #2219

Open
fallintoplace wants to merge 2 commits into
NVIDIA:mainfrom
fallintoplace:fix/schedule-from-task-cleanup
Open

Fix schedule_from task cleanup before start#2219
fallintoplace wants to merge 2 commits into
NVIDIA:mainfrom
fallintoplace:fix/schedule-from-task-cleanup

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Problem

schedule_from releases the owning pointer for its continuation task during connect(), but the operation state only keeps a raw pointer after that. If the operation is destroyed without calling start(), the task never reaches the queue and its device and pinned allocations are not freed.

Fix

  • Keep the continuation task owned by the operation state until the inner operation is started.
  • Release ownership immediately before calling start(inner_op_).
  • Keep cleanup correct when setup reports a CUDA error or connecting the inner sender unwinds.

Test

  • Added a regression test for destroying an unstarted operation.
  • Added a setup-error regression that fails the environment allocation after storage and task allocation succeed, starts the operation, checks cudaErrorMemoryAllocation, and verifies balanced cleanup.
  • clang-format-21 --dry-run --Werror
  • CMake configure and build with CUDA disabled

@copy-pr-bot

copy-pr-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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.

1 participant