Skip to content

[Bug]: DeepSeek R1 deployment panics when serving requests with cuda memory access #13389

@jorgeantonio21

Description

@jorgeantonio21

Your current environment

PyTorch version: 2.5.1+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A

OS: Ubuntu 24.04.1 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Clang version: Could not collect
CMake version: version 3.28.3
Libc version: glibc-2.39

Python version: 3.12.3 (main, Jan 17 2025, 18:03:48) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.8.0-1015-intel-x86_64-with-glibc2.39
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA H200
GPU 1: NVIDIA H200
GPU 2: NVIDIA H200
GPU 3: NVIDIA H200
GPU 4: NVIDIA H200
GPU 5: NVIDIA H200
GPU 6: NVIDIA H200
GPU 7: NVIDIA H200

Nvidia driver version: 550.127.08
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               96
On-line CPU(s) list:                  0-95
Vendor ID:                            GenuineIntel
Model name:                           INTEL(R) XEON(R) PLATINUM 8568Y+
CPU family:                           6
Model:                                207
Thread(s) per core:                   1
Core(s) per socket:                   48
Socket(s):                            2
Stepping:                             2
CPU(s) scaling MHz:                   29%
CPU max MHz:                          4000.0000
CPU min MHz:                          800.0000
BogoMIPS:                             4600.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect user_shstk avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hfi vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd sgx_lc fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Virtualization:                       VT-x
L1d cache:                            4.5 MiB (96 instances)
L1i cache:                            3 MiB (96 instances)
L2 cache:                             192 MiB (96 instances)
L3 cache:                             600 MiB (2 instances)
NUMA node(s):                         4
NUMA node0 CPU(s):                    0-23
NUMA node1 CPU(s):                    24-47
NUMA node2 CPU(s):                    48-71
NUMA node3 CPU(s):                    72-95
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-ml-py==12.570.86
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] pyzmq==26.2.1
[pip3] torch==2.5.1
[pip3] torchaudio==2.5.1
[pip3] torchvision==0.20.1
[pip3] transformers==4.48.3
[pip3] triton==3.1.0
[conda] Could not collect
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.7.2
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0	GPU1	GPU2	GPU3	GPU4	GPU5	GPU6	GPU7	NIC0	NIC1	NIC2	NIC3	NIC4	NIC5	NIC6	NIC7	NIC8	NIC9	CPU Affinity	NUMA Affinity	GPU NUMA ID
GPU0	 X 	NV18	NV18	NV18	NV18	NV18	NV18	NV18	PIX	NODE	SYS	SYS	SYS	SYS	SYS	SYS	SYS	SYS	0-23	0		N/A
GPU1	NV18	 X 	NV18	NV18	NV18	NV18	NV18	NV18	NODE	PIX	SYS	SYS	SYS	SYS	SYS	SYS	SYS	SYS	0-23	0		N/A
GPU2	NV18	NV18	 X 	NV18	NV18	NV18	NV18	NV18	SYS	SYS	PIX	NODE	SYS	SYS	SYS	SYS	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PIX	SYS	SYS	SYS	SYS	SYS	SYS	NODE	NODE	NODE	 X 	SYS	SYS				
NIC8	SYS	SYS	SYS	SYS	SYS	SYS	PIX	NODE	SYS	SYS	SYS	SYS	SYS	SYS	SYS	SYS	 X 	NODE				
NIC9	SYS	SYS	SYS	SYS	SYS	SYS	NODE	PIX	SYS	SYS	SYS	SYS	SYS	SYS	SYS	SYS	NODE	 X 				

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_1
  NIC2: mlx5_2
  NIC3: mlx5_3
  NIC4: mlx5_4
  NIC5: mlx5_5
  NIC6: mlx5_6
  NIC7: mlx5_7
  NIC8: mlx5_8
  NIC9: mlx5_9

NCCL_CUMEM_ENABLE=0
TORCHINDUCTOR_COMPILE_THREADS=1
CUDA_MODULE_LOADING=LAZY

🐛 Describe the bug

I have a DeepSeek R1 deployment instance (8xH200) running, which fails unexpectedly (after KV cache being allocated at initialization) with cuda leak memory trace error:
ds-chat-completions  | ERROR 02-17 00:38:52 multiproc_worker_utils.py:124] Worker VllmWorkerProcess pid 354 died, exit code: -15
ds-chat-completions  | INFO 02-17 00:38:52 multiproc_worker_utils.py:128] Killing local vLLM worker processes
ds-chat-completions  | Process SpawnProcess-1:
ds-chat-completions  | Traceback (most recent call last):
ds-chat-completions  |   File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
ds-chat-completions  |     self.run()
ds-chat-completions  |   File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run
ds-chat-completions  |     self._target(*self._args, **self._kwargs)
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 391, in run_mp_engine
ds-chat-completions  |     raise e
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 380, in run_mp_engine
ds-chat-completions  |     engine = MQLLMEngine.from_engine_args(engine_args=engine_args,
ds-chat-completions  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 123, in from_engine_args
ds-chat-completions  |     return cls(ipc_path=ipc_path,
ds-chat-completions  |            ^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/multiprocessing/engine.py", line 75, in __init__
ds-chat-completions  |     self.engine = LLMEngine(*args, **kwargs)
ds-chat-completions  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/llm_engine.py", line 276, in __init__
ds-chat-completions  |     self._initialize_kv_caches()
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/llm_engine.py", line 429, in _initialize_kv_caches
ds-chat-completions  |     self.model_executor.initialize_cache(num_gpu_blocks, num_cpu_blocks)
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/executor/executor_base.py", line 121, in initialize_cache
ds-chat-completions  |     self.collective_rpc("initialize_cache",
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/executor/executor_base.py", line 307, in collective_rpc
ds-chat-completions  |     return self._run_workers(method, *args, **(kwargs or {}))
ds-chat-completions  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/executor/mp_distributed_executor.py", line 185, in _run_workers
ds-chat-completions  |     driver_worker_output = run_method(self.driver_worker, sent_method,
ds-chat-completions  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/utils.py", line 2220, in run_method
ds-chat-completions  |     return func(*args, **kwargs)
ds-chat-completions  |            ^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/worker/worker.py", line 291, in initialize_cache
ds-chat-completions  |     raise_if_cache_size_invalid(num_gpu_blocks,
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/worker/worker.py", line 539, in raise_if_cache_size_invalid
ds-chat-completions  |     raise ValueError("No available memory for the cache blocks. "
ds-chat-completions  | ValueError: No available memory for the cache blocks. Try increasing `gpu_memory_utilization` when initializing the engine.
ds-chat-completions  | [rank0]:[W217 00:38:53.895408334 ProcessGroupNCCL.cpp:1250] Warning: WARNING: process group has NOT been destroyed before we destruct ProcessGroupNCCL. On normal program exit, the application should call destroy_process_group to ensure that any pending NCCL operations have finished in this process. In rare cases this process can exit before this point and block the progress of another member of the process group. This constraint has always been present,  but this warning has only been added since PyTorch 2.4 (function operator())
ds-chat-completions  | Traceback (most recent call last):
ds-chat-completions  |   File "<frozen runpy>", line 198, in _run_module_as_main
ds-chat-completions  |   File "<frozen runpy>", line 88, in _run_code
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/api_server.py", line 911, in <module>
ds-chat-completions  |     uvloop.run(run_server(args))
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/uvloop/__init__.py", line 109, in run
ds-chat-completions  |     return __asyncio.run(
ds-chat-completions  |            ^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/lib/python3.12/asyncio/runners.py", line 195, in run
ds-chat-completions  |     return runner.run(main)
ds-chat-completions  |            ^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
ds-chat-completions  |     return self._loop.run_until_complete(task)
ds-chat-completions  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/uvloop/__init__.py", line 61, in wrapper
ds-chat-completions  |     return await main
ds-chat-completions  |            ^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/api_server.py", line 875, in run_server
ds-chat-completions  |     async with build_async_engine_client(args) as engine_client:
ds-chat-completions  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/lib/python3.12/contextlib.py", line 210, in __aenter__
ds-chat-completions  |     return await anext(self.gen)
ds-chat-completions  |            ^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/api_server.py", line 136, in build_async_engine_client
ds-chat-completions  |     async with build_async_engine_client_from_engine_args(
ds-chat-completions  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/lib/python3.12/contextlib.py", line 210, in __aenter__
ds-chat-completions  |     return await anext(self.gen)
ds-chat-completions  |            ^^^^^^^^^^^^^^^^^^^^^
ds-chat-completions  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/api_server.py", line 230, in build_async_engine_client_from_engine_args
ds-chat-completions  |     raise RuntimeError(
ds-chat-completions  | RuntimeError: Engine process failed to start. See stack trace for the root cause.
ds-chat-completions  | /usr/lib/python3.12/multiprocessing/resource_tracker.py:255: UserWarning: resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdown
ds-chat-completions  |   warnings.warn('resource_tracker: There appear to be %d '

I presume this should not happen, as the KV cache is allocated at initialization, and therefore we would need to do further memory allocations if not enoug

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleOver 90 days of inactivity

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions