Skip to content

Fix CUDA process enumeration race in checkpoint - #13933

Open
luiscape wants to merge 1 commit into
google:masterfrom
luiscape:luis/cuda-snapshot-race-fix
Open

Fix CUDA process enumeration race in checkpoint#13933
luiscape wants to merge 1 commit into
google:masterfrom
luiscape:luis/cuda-snapshot-race-fix

Conversation

@luiscape

@luiscape luiscape commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

preSaveCuda enumerates CUDA processes once, then suspends them with cuda-checkpoint --toggle. The issue here is that processes may create new CUDA sessions after enumeration, leading to either checkpoint failues (because a new session now has been initialized) or restore failures (because a new in-flight session is initializing and can no longer complete).

To fix this race, I am enumerating CUDA sessions repeatedly until no further sessions appear. This replicates what CRIU GPU does in seize.c:collect_loop(), which I think is a reasonable approach.

I tested this on a 4 x A10G instance with multiple workloads and different combination of GPUs (1, 2, 4). I used PyTorch directly, but also vLLM and SGLang. Multi-GPU workloads are checkpointed and restored successfully after this change.

`preSaveCuda` enumerates CUDA processes once, then suspends them with
`cuda-checkpoint --toggle`. The issue here is that processes may create
new CUDA sessions after enumeration, leading to either checkpoint
failues (because a new session now has been initialized) or restore
failures (because a new in-flight session is initializing and can no
longer complete).

To fix this race, I am enumerating CUDA sessions repeatedly until no
further sessions appear. This replicates what CRIU GPU does in
([`seize.c:collect_loop()`](https://github.com/checkpoint-restore/criu/blob/894a7c3f85a7c32cf6a88f956b6fb0381b5bfe06/criu/seize.c#L964-L995),
which I think is a reasonable approach.

I tested this on a 4 x A10G instance with multiple workloads and
different combination of GPUs (1, 2, 4). I used PyTorch directly, but
also vLLM and SGLang. Multi-GPU workloads are checkpointed and restored
successfully after this change.
@github-actions
github-actions Bot requested review from milantracy and nybidari July 31, 2026 05:11
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