Skip to content

[FEA] Invalidate gRPC chunked-download sessions when deleting a job #1612

Description

@coderabbitai

Summary

DeleteResult should invalidate all active chunked-result download sessions associated with the deleted job.

Rationale

StartChunkedDownload snapshots completed result arrays into chunked_downloads. Deleting the job currently removes the tracker entry, pending data, and log file, but a client that already holds a download_id can continue retrieving the snapshotted result. This leaves deleted job data accessible and resident until the download session is finished or expires.

Affected areas

  • cpp/src/grpc/server/grpc_service_impl.cpp
    • StartChunkedDownload
    • GetResultChunk
    • download-session lifecycle coordination
  • cpp/src/grpc/server/grpc_job_management.cpp
    • delete_job cleanup path
  • cpp/src/grpc/server/grpc_server_types.hpp
    • any required download-session metadata or lifecycle declarations
  • gRPC integration tests covering DeleteResult and chunked downloads

Required changes

  1. Associate each ChunkedDownloadState entry with its originating job_id.
  2. During delete_job, remove every matching download session while holding chunked_downloads_mutex.
  3. Coordinate StartChunkedDownload and deletion so that no session can be created after deletion completes, including concurrent requests.
  4. Ensure subsequent GetResultChunk calls for an invalidated download_id return the existing unknown-download/not-found behavior.
  5. Add integration coverage for deleting a job with an active chunked download and for the creation/deletion race.

Acceptance criteria

  • After a successful DeleteResult, no active chunked-download session remains for that job.
  • A previously issued download_id cannot return any further result data after deletion.
  • Concurrent StartChunkedDownload and DeleteResult cannot leave a usable session for a deleted job.
  • Existing chunked-download behavior for non-deleted jobs remains unchanged.

Backlinks

Metadata

Metadata

Assignees

Labels

awaiting responseThis expects a response from maintainer or contributor depending on who requested in last comment.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions