verl icon indicating copy to clipboard operation
verl copied to clipboard

[rollout, vllm] EngineCore "RPC call to sample_tokens timed out" persists in long agent-loop rollout

Open tongruiliu opened this issue 6 months ago • 2 comments

System Info

Running GRPO on Qwen3-VL-27B with verl + Megatron + vLLM 0.20.2, 256 H200s, TP=4 per rollout engine, mode=async, n=16, max_num_batched_tokens=30720, max_model_len=130000, gpu_memory_utilization=0.55, multi-turn agent loop with agent.num_workers=512, max_assistant_turns=30. After 6 hours of healthy rollout, one EngineCore on one node dies and brings the whole job down. Just before death vLLM dumps the in-flight batch:

(EngineCore) ERROR [dump_input.py:79] Dumping scheduler output for model execution:
SchedulerOutput(
  scheduled_new_reqs=[14 prompts, all 5.8k-7.5k prompt_token_ids_len, mm_features=[]],
  scheduled_cached_reqs=CachedRequestData([38 decode reqs]),
  num_computed_tokens=[5488..7599], num_output_tokens=[1..582],
  total_num_scheduled_tokens=3347,
  scheduled_spec_decode_tokens={}, scheduled_encoder_inputs={},
  num_common_prefix_blocks=[0, 0, 0, 0],
  finished_req_ids=[], preempted_req_ids=[],
  ...)

i.e. a perfectly normal step — text-only batch, ~3.3k scheduled tokens total, no preemption, no encoder inputs. Then:

(EngineCore) ERROR [core.py:1138] EngineCore encountered a fatal error.
(EngineCore) ERROR [core.py:1138] Traceback (most recent call last):
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/executor/multiproc_executor.py", line 386, in get_response
(EngineCore) ERROR [core.py:1138]     status, result = mq.dequeue(timeout=dequeue_timeout)
(EngineCore) ERROR [core.py:1138]   File ".../vllm/distributed/device_communicators/shm_broadcast.py", line 755, in dequeue
(EngineCore) ERROR [core.py:1138]     with self.acquire_read(timeout, indefinite) as buf:
(EngineCore) ERROR [core.py:1138]   File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__
(EngineCore) ERROR [core.py:1138]     return next(self.gen)
(EngineCore) ERROR [core.py:1138]   File ".../vllm/distributed/device_communicators/shm_broadcast.py", line 674, in acquire_read
(EngineCore) ERROR [core.py:1138]     self._spin_condition.wait(timeout_ms=read_timeout.timeout_ms())
(EngineCore) ERROR [core.py:1138]   File ".../vllm/distributed/device_communicators/shm_broadcast.py", line 631, in timeout_ms
(EngineCore) ERROR [core.py:1138]     raise TimeoutError
(EngineCore) ERROR [core.py:1138] TimeoutError
(EngineCore) ERROR [core.py:1138]
(EngineCore) ERROR [core.py:1138] The above exception was the direct cause of the following exception:
(EngineCore) ERROR [core.py:1138]
(EngineCore) ERROR [core.py:1138] Traceback (most recent call last):
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/engine/core.py", line 1129, in run_engine_core
(EngineCore) ERROR [core.py:1138]     engine_core.run_busy_loop()
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/engine/core.py", line 1170, in run_busy_loop
(EngineCore) ERROR [core.py:1138]     self._process_engine_step()
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/engine/core.py", line 1209, in _process_engine_step
(EngineCore) ERROR [core.py:1138]     outputs, model_executed = self.step_fn()
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/engine/core.py", line 521, in step_with_batch_queue
(EngineCore) ERROR [core.py:1138]     model_output = future.result()
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/executor/multiproc_executor.py", line 90, in result
(EngineCore) ERROR [core.py:1138]     return super().result()
(EngineCore) ERROR [core.py:1138]   File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
(EngineCore) ERROR [core.py:1138]     return self.__get_result()
(EngineCore) ERROR [core.py:1138]   File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
(EngineCore) ERROR [core.py:1138]     raise self._exception
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/executor/multiproc_executor.py", line 94, in _wait_for_response
(EngineCore) ERROR [core.py:1138]     response = self.aggregate(self.get_response())
(EngineCore) ERROR [core.py:1138]   File ".../vllm/v1/executor/multiproc_executor.py", line 388, in get_response
(EngineCore) ERROR [core.py:1138]     raise TimeoutError(f"RPC call to {method} timed out.") from e
(EngineCore) ERROR [core.py:1138] TimeoutError: RPC call to sample_tokens timed out.

Followed by the AsyncLLM output handler giving up and converting to EngineDeadError:

ERROR [async_llm.py:704] AsyncLLM output_handler failed.
ERROR [async_llm.py:704] Traceback (most recent call last):
ERROR [async_llm.py:704]   File ".../vllm/v1/engine/async_llm.py", line 660, in output_handler
ERROR [async_llm.py:704]     outputs = await engine_core.get_output_async()
ERROR [async_llm.py:704]   File ".../vllm/v1/engine/core_client.py", line 998, in get_output_async
ERROR [async_llm.py:704]     raise self._format_exception(outputs) from None
ERROR [async_llm.py:704] vllm.v1.engine.exceptions.EngineDeadError: EngineCore encountered an issue. See stack trace (above) for the root cause.

Inner cause is shm_broadcast.py:631 raise TimeoutError — i.e. the EngineCore parent's mq.dequeue never got a reply from one of its TP worker subprocesses for sample_tokens. The dump_input frame right before death shows a normal batch (total_num_scheduled_tokens=12314, text-only, one 7056-token prefill chunk + decodes), nothing unusually heavy.

Already tried attention_backend=TRITON_ATTN (per #5659) and lowered max_num_batched_tokens to 30720 — still hangs.

Full log search shows no OOM, no NCCL error, no CUDA error, no SIGSEGV, no worker death message. The worker is silently stuck.

Related: #5659 (TRITON_ATTN workaround insufficient here), #4596, #4308, vllm-project/vllm#35496 (same surface error on a totally different model, suggesting this is a general vLLM V1 multiproc-executor failure mode).

Information

  • [ ] The official example scripts
  • [x] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [x] My own task or dataset (give details below)

Reproduction

The hang requires the full 256 H200 cluster and 6 h of agent-loop rollout to manifest; I don't have a minimal repro.

python3 -m ... \
  --config-name=ppo_megatron_trainer \
  algorithm.adv_estimator=grpo \
  algorithm.use_kl_in_reward=False \
  critic.enable=False \
  data.train_batch_size=256 \
  data.max_prompt_length=8192 \
  data.max_response_length=30000 \
  data.return_raw_chat=True \
  data.filter_overlong_prompts=True \
  actor_rollout_ref.model.trust_remote_code=True \
  actor_rollout_ref.model.use_remove_padding=True \
  actor_rollout_ref.rollout.name=vllm \
  actor_rollout_ref.rollout.mode=async \
  actor_rollout_ref.rollout.dtype=bfloat16 \
  actor_rollout_ref.rollout.n=16 \
  actor_rollout_ref.rollout.prompt_length=60000 \
  actor_rollout_ref.rollout.response_length=64000 \
  actor_rollout_ref.rollout.max_model_len=130000 \
  actor_rollout_ref.rollout.max_num_batched_tokens=30720 \
  actor_rollout_ref.rollout.multi_turn.enable=True \
  actor_rollout_ref.rollout.multi_turn.max_assistant_turns=30 \
  actor_rollout_ref.rollout.multi_turn.format=qwen3_coder \
  actor_rollout_ref.rollout.agent.default_agent_loop=... \
  actor_rollout_ref.rollout.agent.num_workers=512 \
  actor_rollout_ref.rollout.calculate_log_probs=True \
  actor_rollout_ref.rollout.tensor_model_parallel_size=4 \
  actor_rollout_ref.rollout.pipeline_model_parallel_size=1 \
  actor_rollout_ref.rollout.gpu_memory_utilization=0.55 \
  +actor_rollout_ref.rollout.engine_kwargs.vllm.disable_custom_all_reduce=True \
  ++actor_rollout_ref.rollout.engine_kwargs.vllm.attention_backend=TRITON_ATTN \
  actor_rollout_ref.actor.optim.lr=1e-6 \
  actor_rollout_ref.actor.ppo_mini_batch_size=256 \
  actor_rollout_ref.actor.use_dynamic_bsz=True \
  actor_rollout_ref.actor.use_kl_loss=False \
  actor_rollout_ref.actor.megatron.tensor_model_parallel_size=4 \
  actor_rollout_ref.actor.megatron.pipeline_model_parallel_size=1 \
  actor_rollout_ref.actor.megatron.context_parallel_size=4 \
  actor_rollout_ref.actor.megatron.use_mbridge=True \
  actor_rollout_ref.actor.megatron.vanilla_mbridge=True \
  actor_rollout_ref.actor.megatron.optimizer_offload=True \
  actor_rollout_ref.actor.megatron.param_offload=True \
  actor_rollout_ref.actor.megatron.grad_offload=True \
  actor_rollout_ref.actor.megatron.override_transformer_config.recompute_granularity=full \
  actor_rollout_ref.actor.megatron.override_transformer_config.recompute_method=uniform \
  actor_rollout_ref.actor.megatron.override_transformer_config.recompute_num_layers=1 \
  trainer.nnodes=32 \
  trainer.n_gpus_per_node=8 \
  trainer.total_epochs=100 \
  trainer.val_before_train=False

Env exports from the launch script:

export VLLM_USE_V1=1
export VLLM_ALLREDUCE_USE_SYMM_MEM=0
export RAY_USE_UVLOOP=0
export CUDA_DEVICE_MAX_CONNECTIONS=1
export NCCL_TIMEOUT=14400
export PYTORCH_ALLOC_CONF=expandable_segments:True

Full stack trace from the dying EngineCore (with the dump_input frame that precedes it) is in the attached log

Expected behavior

Training runs the configured 100 epochs without an EngineCore in any rollout engine silently hanging. Failing that, when a TP worker does become unresponsive, the error surfaced upward should identify which worker (rank, pid, host) and what op it was blocked on — rather than a generic TimeoutError: RPC call to sample_tokens timed out. with no further context. Ideally a single dead rollout engine would not bring the entire 32-node trainer down.

tongruiliu avatar Jun 03 '26 03:06 tongruiliu

totally same issue, Im trying increase VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS. it did help the job go through more steps, but still encounter this issue at last. have you figure it out now? I think it is more related to vllm rather than verl. Im gonna try sglang as rollout engine next step

EricOlivier avatar Jun 30 '26 01:06 EricOlivier

I met the same issue and resolved my case by setting vllm.max_num_seqs to a smaller num. The default value is 256 if not set. In my case by reduce it to 8-24, the failure gone. For your reference to have a try. The failure log and my mitigation behavior indicates suspicious bug on vllm scheduler.

jianwenzh avatar Sep 20 '26 02:09 jianwenzh