File tree 1 file changed +11
-3
lines changed
vllm/engine/multiprocessing
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,14 @@ async def setup(self):
262
262
"""Setup the client before it starts sending server requests."""
263
263
264
264
# Start output_loop
265
- self .output_loop = asyncio .create_task (self .run_output_handler_loop ())
265
+ if self .output_loop is None :
266
+ # only generate once to avoid multiple concurrent output_loops
267
+ # this will lead to race conditions and wrong orders of tokens
268
+ # returned by the engine
269
+ # setup will be called multiple times during the startup of
270
+ # the engine
271
+ self .output_loop = asyncio .create_task (
272
+ self .run_output_handler_loop ())
266
273
267
274
with self .get_data_socket () as socket :
268
275
# Wait until server is ready.
@@ -271,8 +278,9 @@ async def setup(self):
271
278
self .tracing_flag = response .tracing_enabled
272
279
273
280
# Start health_loop.
274
- self .health_loop = asyncio .create_task (
275
- self .run_heartbeat_loop (timeout = VLLM_RPC_TIMEOUT ))
281
+ if self .health_loop is None :
282
+ self .health_loop = asyncio .create_task (
283
+ self .run_heartbeat_loop (timeout = VLLM_RPC_TIMEOUT ))
276
284
277
285
def close (self ):
278
286
"""Destroy the ZeroMQ Context."""
You can’t perform that action at this time.
0 commit comments