Open junior-zsy opened 4 months ago
@youkaichao Please help me check, I suspect it's a timeout issue. Thank you
Does it occur everytime? Do you have a request that can stably trigger the error?
i encountered the same problem. Both qwen2-72b and qwen1.5-110b produce the asyncio.exceptions.CancelledError after a few hours running.
Exactly the same problem I've been encountering since Jun 14. Maybe some semaphore issue?
Again it happened this morning. It seemed that the generation throughput was getting slower and slower and finally not responding (context length not growing, every request was a new chat) . I guess there are some resources not released after request finished.
@junior-zsy We encountered the same problem when using 4 L40 GPUs for inference based on Qwen2-72B-Instruct-128K. We solved the problem by setting the following two parameters:
llm = LLM(
...,
enable_chunked_prefill=True,
max_num_batched_tokens=8192
)
You can adjust max_num_batched_tokens
appropriately according to your GPU resources.
@junior-zsy We encountered the same problem when using 4 L40 GPUs for inference based on Qwen2-72B-Instruct-128K. We solved the problem by setting the following two parameters:
llm = LLM( ..., enable_chunked_prefill=True, max_num_batched_tokens=8192 )
You can adjust
max_num_batched_tokens
appropriately according to your GPU resources.
thank you,But the above is not useful to me, I have found the real reason
@youkaichao I have discovered the ultimate cause of this problem,The problem lies in run_engine_loop function
has_requests_in_progress = False
while True:
if not has_requests_in_progress:
logger.debug("Waiting for new requests...")
await self._request_tracker.wait_for_new_requests()
logger.debug("Got new requests!")
# Abort if iteration takes too long due to unrecoverable errors
# (eg. NCCL timeouts).
try:
async with asyncio_timeout(ENGINE_ITERATION_TIMEOUT_S):
has_requests_in_progress = await self.engine_step()
except asyncio.TimeoutError as exc:
logger.error(
"Engine iteration timed out. This should never happen!")
self.set_errored(exc)
raise # If a timeout is triggered, the entire server crashes because there is no try exception caught on this exception
await asyncio.sleep(0)
def start_background_loop(self) -> None:
"""Start the background loop."""
if self.errored:
raise AsyncEngineDeadError(
"Background loop has errored already.") from self._errored_with
if self.is_running:
raise RuntimeError("Background loop is already running.")
# Initialize the RequestTracker here so it uses the right event loop.
self._request_tracker = RequestTracker()
# Failure to capture exceptions resulted in program crash
self._background_loop_unshielded = asyncio.get_event_loop(
).create_task(self.run_engine_loop())
self._background_loop_unshielded.add_done_callback(
partial(_log_task_completion, error_callback=self._error_callback))
self.background_loop = asyncio.shield(self._background_loop_unshielded)
When a request triggers a timeout, a single exception can cause the entire service to crash. The raise passes an exception to the upper layer, but the upper layer's code does not try exception to catch the exception. In the end, the entire service crashes,I can solve the above problem by setting VLLM-ENGINE-ITERATION-TIMEOUT, but I don't understand why vllm code needs to be written like this, raise, but the upper layer did not capture it. Thank you
@youkaichao I have discovered the ultimate cause of this problem,The problem lies in run_engine_loop function
has_requests_in_progress = False while True: if not has_requests_in_progress: logger.debug("Waiting for new requests...") await self._request_tracker.wait_for_new_requests() logger.debug("Got new requests!") # Abort if iteration takes too long due to unrecoverable errors # (eg. NCCL timeouts). try: async with asyncio_timeout(ENGINE_ITERATION_TIMEOUT_S): has_requests_in_progress = await self.engine_step() except asyncio.TimeoutError as exc: logger.error( "Engine iteration timed out. This should never happen!") self.set_errored(exc) raise # If a timeout is triggered, the entire server crashes because there is no try exception caught on this exception await asyncio.sleep(0) def start_background_loop(self) -> None: """Start the background loop.""" if self.errored: raise AsyncEngineDeadError( "Background loop has errored already.") from self._errored_with if self.is_running: raise RuntimeError("Background loop is already running.") # Initialize the RequestTracker here so it uses the right event loop. self._request_tracker = RequestTracker() # Failure to capture exceptions resulted in program crash self._background_loop_unshielded = asyncio.get_event_loop( ).create_task(self.run_engine_loop()) self._background_loop_unshielded.add_done_callback( partial(_log_task_completion, error_callback=self._error_callback)) self.background_loop = asyncio.shield(self._background_loop_unshielded)
When a request triggers a timeout, a single exception can cause the entire service to crash. The raise passes an exception to the upper layer, but the upper layer's code does not try exception to catch the exception. In the end, the entire service crashes,I can solve the above problem by setting VLLM-ENGINE-ITERATION-TIMEOUT, but I don't understand why vllm code needs to be written like this, raise, but the upper layer did not capture it. Thank you
I have tried setting VLLM-ENGINE-ITERATION-TIMEOUT=600, using "try-catch" in start_background_loop and abort this invalid request in run_engine_loop, but they don't make effect. Do you have any other idea about how to deal with this error?
@junior-zsy We encountered the same problem when using 4 L40 GPUs for inference based on Qwen2-72B-Instruct-128K. We solved the problem by setting the following two parameters:
llm = LLM( ..., enable_chunked_prefill=True, max_num_batched_tokens=8192 )
You can adjust
max_num_batched_tokens
appropriately according to your GPU resources.
Thanks, the method works for me.
Your current environment
PyTorch version: 2.3.0+cu121 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A
OS: Ubuntu Jammy Jellyfish (development branch) (x86_64) GCC version: Could not collect Clang version: Could not collect CMake version: version 3.29.5 Libc version: glibc-2.35
Python version: 3.10.14 (main, May 6 2024, 19:42:50) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.10.134-15.al8.x86_64-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: Could not collect CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA L20 GPU 1: NVIDIA L20 GPU 2: NVIDIA L20 GPU 3: NVIDIA L20 GPU 4: NVIDIA L20 GPU 5: NVIDIA L20 GPU 6: NVIDIA L20 GPU 7: NVIDIA L20
Nvidia driver version: 535.161.07 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: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Gold 6462C CPU family: 6 Model: 143 Thread(s) per core: 2 Core(s) per socket: 32 Socket(s): 2 Stepping: 8 CPU max MHz: 3900.0000 CPU min MHz: 800.0000 BogoMIPS: 6600.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 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm 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 avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm uintr md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities Virtualization: VT-x L1d cache: 3 MiB (64 instances) L1i cache: 2 MiB (64 instances) L2 cache: 128 MiB (64 instances) L3 cache: 120 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-31,64-95 NUMA node1 CPU(s): 32-63,96-127 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected
Versions of relevant libraries: [pip3] numpy==1.26.4 [pip3] nvidia-nccl-cu12==2.20.5 [pip3] torch==2.3.0 [pip3] transformers==4.41.2 [pip3] triton==2.3.0 [conda] numpy 1.26.4 pypi_0 pypi [conda] nvidia-nccl-cu12 2.20.5 pypi_0 pypi [conda] torch 2.3.0 pypi_0 pypi [conda] transformers 4.41.2 pypi_0 pypi [conda] triton 2.3.0 pypi_0 pypi ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: 0.5.0 vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 GPU1 GPU2 GPU3 GPU4 GPU5 GPU6 GPU7 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X PIX NODE NODE SYS SYS SYS SYS 0-31,64-95 0 N/A GPU1 PIX X NODE NODE SYS SYS SYS SYS 0-31,64-95 0 N/A GPU2 NODE NODE X PIX SYS SYS SYS SYS 0-31,64-95 0 N/A GPU3 NODE NODE PIX X SYS SYS SYS SYS 0-31,64-95 0 N/A GPU4 SYS SYS SYS SYS X PIX NODE NODE 32-63,96-127 1 N/A GPU5 SYS SYS SYS SYS PIX X NODE NODE 32-63,96-127 1 N/A GPU6 SYS SYS SYS SYS NODE NODE X PIX 32-63,96-127 1 N/A GPU7 SYS SYS SYS SYS NODE NODE PIX X 32-63,96-127 1 N/A
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
🐛 Describe the bug
I use vllm/vllm-openai:v0.5.0 by Distributed Inference and Serving on two L40s machine , 8 cards per machine, a total of 16 cards for two machines
On head node
ray start --head
On worker nodes
ray start --address=xxx:6379
python -m vllm.entrypoints.openai.api_server --served-model-name Qwen2-72B-Instruct --trust-remote-code --tensor-parallel-size 16 --model /model/Qwen2-72B-Instruct --max-num-seqs 1
90000 token no problem ,100000 token server is down
then I got the following error:
ERROR: Exception in ASGI application Traceback (most recent call last): File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/responses.py", line 265, in call await wrap(partial(self.listen_for_disconnect, receive)) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/responses.py", line 261, in wrap await func() File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/responses.py", line 238, in listen_for_disconnect message = await receive() File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 553, in receive await self.message_event.wait() File "/root/miniconda3/envs/vllm/lib/python3.10/asyncio/locks.py", line 214, in wait await fut asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f24f6169600
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/middleware/cors.py", line 85, in call await self.app(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/routing.py", line 75, in app await response(scope, receive, send) File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/starlette/responses.py", line 258, in call async with anyio.create_task_group() as task_group: File "/root/miniconda3/envs/vllm/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 680, in aexit raise BaseExceptionGroup( exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)