@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / acf8aeb79e
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[Misc] normalize multiprocessing Queue usage (#22371)

Signed-off-by: Andy Xie <andy.xning@gmail.com>

Ning Xie committed Aug 8, 2025 at 09:57 UTC acf8aeb79e23c32217dd37b5e96847302ae4d0b7
1 file changed +18 -2
tests/test_sharded_state_loader.py
+18 -2
@@ -118,8 +118,17 @@ def test_sharded_state_loader(enable_lora, tp_size, num_gpus_available,
118 tensor_parallel_size=tp_size,
119 ))
120 p.start()
121 - p.join()
121 + # Call queue.get() before p.join() to prevent deadlock:
122 + # If p.join() is called before queue.get() and the queue is full,
123 + # the child process may block while writing to the queue and never
124 + # terminate, causing the parent to wait indefinitely on p.join().
125 + # See: https://github.com/vllm-project/vllm/pull/22371#discussion_r2257773814
126 out_before = queue.get()
127 + p.join()
128 + queue.close()
129 + queue.join_thread()
130 +
131 + queue = ctx.Queue()
132
133 p = ctx.Process(target=_run_generate,
134 args=(output_dir, queue),
@@ -131,7 +140,14 @@ def test_sharded_state_loader(enable_lora, tp_size, num_gpus_available,
140 load_format="sharded_state",
141 ))
142 p.start()
134 - p.join()
143 + # Call queue.get() before p.join() to prevent deadlock:
144 + # If p.join() is called before queue.get() and the queue is full,
145 + # the child process may block while writing to the queue and never
146 + # terminate, causing the parent to wait indefinitely on p.join().
147 + # See: https://github.com/vllm-project/vllm/pull/22371#discussion_r2257773814
148 out_after = queue.get()
149 + p.join()
150 + queue.close()
151 + queue.join_thread()
152
153 assert out_before == out_after