You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[core] Job stuck in PENDING forever when HTTP request is cancelled during submission #62766
When a job submission HTTP request is cancelled (e.g., client timeout, connection reset) after the job has been written to GCS as PENDING but before the supervisor actor is created, the job remains in PENDING status forever. No supervisor actor is spawned, and the job is never cleaned up — it becomes an orphan.
Expected: The job should transition to FAILED with a clear error message.
How to reproduce
This bug requires a specific timing sequence:
Client submits a job via POST /api/jobs/
The dashboard agent handler writes the job to GCS as PENDING (via put_info(overwrite=False))
Before the supervisor actor is created, asyncio.CancelledError is raised — this happens when aiohttp cancels the handler coroutine because the HTTP client disconnected
The CancelledError propagates through submit_job uncaught, leaving the job permanently PENDING
Versions / Dependencies
ray-2.47
python-3.9
Reproduction script
In job_manager.py submit_job(), after put_info(submission_id, job_info, overwrite=False) writes PENDING to GCS, there are multiple await points before the supervisor actor is created:
put_info(PENDING) ← job exists in GCS
↓
await _get_scheduling_strategy(...) ← CancelledError can strike here
↓
supervisor_actor.options(...).remote(...)
↓
supervisor.run.remote(...)
↓
run_background_task(_monitor_job(...)) ← only now is the job "alive"
The existing error handler is:
except Exception as e:
await self._job_info_client.put_status(submission_id, JobStatus.FAILED, ...)
asyncio.CancelledError inherits from BaseException, not Exception. So this handler does not catch it. The CancelledError propagates out, leaving an orphan PENDING entry in GCS.
Issue Severity
Medium: It is a significant difficulty but I can work around it.
I'd like to take this, since #62951 was closed as stale. Plan: in JobManager.submit_job, once the job has been written as PENDING, catch asyncio.CancelledError before the supervisor actor exists, mark the job FAILED with a message saying the submission was cancelled, and re-raise. I'll add a regression test in test_job_manager.py that cancels a submission at that point.
Activity
Myasuka commentedon Apr 20, 2026
I'll prepare a bug fix for this problem.
pardeep-singh commentedon Oct 18, 2026
I'd like to take this, since #62951 was closed as stale. Plan: in
JobManager.submit_job, once the job has been written as PENDING, catchasyncio.CancelledErrorbefore the supervisor actor exists, mark the job FAILED with a message saying the submission was cancelled, and re-raise. I'll add a regression test intest_job_manager.pythat cancels a submission at that point.